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 the benefit of delegate in c#?
Practcle scenario where I can use abstract class and where I can use Interface
1 Answers Jeevan Technologies,
What do you mean by object pooling?
Why use “using” in c#?
How many catch blocks can be there for a single try block?
Explain the difference between “as” and “is” operators used in c#?
How to find out that the code is written as managed or un-managed code?
What is difference between arraylist and list in c#?
What?s the implicit name of the parameter that gets passed into the class? set method?
What is Covariance and contravariance in C#?
what is the difference between a struct and a class in c#?
If you donot specify an access modifier for a method, what is the default access modifier?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)