Is string reference type / value type ?
Answer Posted / 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 |
Post New Answer View All Answers
Is double a decimal?
What are primitive types in c#?
How do you define a predicate?
What does console readline do?
What are custom exceptions?
What is the advantage of extension method in c#?
Is int reference type c#?
What is expression tree in c#?
What is data reader in c#?
Hello! How to do this: "Create manifest utility intended for creating update content files. Application should take a set of files as input parameter and generate XML based manifest file as output one." I use C# and vs.net 2003. It's urgent! Help please, thanks. Mayana
Why delegates are type safe in c#?
Can int be null c#?
Why does my windows application pop up a console window every time I run it?
How to parse a date time string?
What is hashset c#?