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


Please Help Members By Posting Answers For Below Questions

What can be done with c#?

548


What are the Configuration files in .net?

625


Can datetime be null c#?

587


What is cosole application?

691


Why is dll used?

703






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

1608


Why singleton pattern is used in c#?

632


What do you mean by winforms in c#?

612


What is using in c#?

585


What is boxing and unboxing in c#?

568


What are the collection types can be used in c#?

564


Can you declare a class or a struct as constant?

648


how background thread access to ui control?

705


What is a function c#?

630


Why can't we use a static class instead of singleton?

556