Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String vs string

Status
Not open for further replies.

Smeat

Programmer
Mar 27, 2004
193
0
0
GB
Can somebody explain the difference between the following 2 declarations please?

string _myString;

and

String _myString;

TIA

Smeat
 
msdn

should do it for you


____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Why not create a small test program that uses both, then look at the IL code that gets created, using a tool like ildasm.exe (comes with the framework) or Reflector (a free download from Lutz Roeder)?

This is an extremely useful technique for answering these sorts of questions.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Yes that is a great way to get a very clear answer to this type of question. I think reading the documentation prior to jumping into any code writing is the best first step though. I've seen it save far more time over the years of a true understanding on what you are doing. honestly I question about anyone that doesn't read a language or framework or whatever doc's prior to actually writing a program in it. Yeah teh Hello World program is great and everyone does it. but how many people do it after reading per say C#.NET's supporting reference documentation and truely know how the hello program outputs that string to the screen :)


____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Isn't that like saying : you should understand the chinese language before trying to speak it?

I agree that docs are quite useful - don't get me wrong!
 
So you're comparing a spoken language to a programming language? Now that is an interesting topic. But alas and off topic one :)


____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
The intrinsic data types in C# are no more than aliases for structures and classes defined in the System namespace. So, string is an alias for System.String and the compiler will resolve it for you as such. If you so choose, feel free to declare your built-in data types using their real name as instances of classes and structures.

string == System.String
int == System.Int32
and so on.

Even better, if you have using System; in your program you can just use the class/structure name without qualifying them with System

using System;

class myTest
{
Public Int32 x = 5;
Public String str=”Hello”;
}


Walid Magd (MCP)

The primary challenge of every software development team is to engineer the illusion of simplicity in the face of essential complexity.
-Grady Booch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top