Is string reference type / value type ?
Answers were Sorted based on User's Feedback
Answer / ankur sehgal
string is reference type but it behaves as value
type.Because every time u assign a value to string a new
object is created.
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / vinay tiwari
//string is a refference type but it behavious like a value
//type.
//following programe show both charactersitic of string.
using System;
class a
{
public static void Main(String [] args)
{
String str1="hello";
String str2=str1;
String str3="hello";
Console.WriteLine(str1);
Console.WriteLine(str2);
if(str1==str3)
{
Console.WriteLine("str1 anb str3 are
equal ");
}
}
}
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / avisek
string is referrence type....
bcz there is no limitations of string means it can have variable length......thats why str[0],str[1],
string stores only the referrence to the value stored in it....
Is This Answer Correct ? | 2 Yes | 0 No |
It's a common misconception that string is a value type.
That's because its immutability makes it act sort of like
a value type. It actually acts like a normal reference type
Is This Answer Correct ? | 3 Yes | 2 No |
What is delegation in oops?
List the differences between method overriding and method overloading?
Write a console application and implement the ternary operator to decide whether the age a user entered after being prompted is allowed to vote or not(given that only citizens between 18 and 120 years only inclusive can vote). Use exception handling for non-numerical input.
How do I develop c# apps?
How can we insert 100 records @ a time without using for loop into the databse
What is the purpose of namespace in c#?
What .exe means?
What are the features of c#?
what class is underneath the sortedlist class?
What is use of list in c#?
What is argument in c#?
What is icomparer in c#?