hai friends ? I am almost completing my C#.net.. but a small doubt is whether "string " data type is a reference type or value type? because in some books i find it as reference type and in some books i find it as value type which can store upto 4GB? which one is correct? one more is thing canwe run MS.NET in LINUX operating system? if yes which web server we had to use

Whilst a string may often behave like a value type it is in fact an Immutable Reference type. Some extra behaviours (such as value comparisons and value reassignments) have been added for convenience but they are still a reference type at the core...thats why string.Replace() doesnt affect the string but returns a new value to be stored (optionally in the same varaible).
See the msdn page for more in depth info.

Strings in C# are reference types, as indicated by the C# Reference on MSDN.

Maximum string length will depend on your machine's architecture and memory allocation situation, but the String.Length property is a 32-bit integer, so there's an effective upper bound of Int32.MaxValue.

Running (and developing) .NET applications on Linux can be done with Mono.

I'm not sure what you mean by "which web server we had to use", but if you want an ASP.NET equivalent, see Mono's ASP.NET page.

Comments
Good answer

Whilst a string may often behave like a value type it is in fact an Immutable Reference type. Some extra behaviours (such as value comparisons and value reassignments) have been added for convenience but they are still a reference type at the core...thats why string.Replace() doesnt affect the string but returns a new value to be stored (optionally in the same varaible).
See the msdn page for more in depth info.

You mean the MSDN page that clearly says "Although string is a reference type..."?

Yes, strings are immutable and have special behavior that anyone that uses them should know about, but please don't spread misinformation. It is important, for example, to understand that when using strings as method parameters, they are passed by reference, not by value.

I'm sorry...they ARE reference types, and they ARE immutable but i was wrong to say they are an immutable reference type?

I'm sorry...they ARE reference types, and they ARE immutable but i was wrong to say they are an immutable reference type?

Oh holy crap. I totally misread that the first time--now that I look at it again, you had it right all along. SORRY! :,(

Lol, apology accepted and no hard feelings :p
Your podt agreed with everything mine said then told me off for spreading missinformation...i was trying to figure out what part was wrong :)

Lol, apology accepted and no hard feelings :p
Your podt agreed with everything mine said then told me off for spreading missinformation...i was trying to figure out what part was wrong :)

And I swear I read it twice to make sure it said what I thought it said... ackthbbbpt.

This article has been dead for over six months. Start a new discussion instead.