string foo = "ABC"; // should really use var here and let the compiler determine the type, but for examples' sake...
string bar = "XZY";
var otherString = String.Format("Foo: {0}, Bar: {1}", foo, bar);
I think the above have answered the question, but my personal preference is to use 'string' when dealing with the type, and 'String' when dealing with functions of the type. Eg:
Code:string foo = "ABC"; // should really use var here and let the compiler determine the type, but for examples' sake... string bar = "XZY"; var otherString = String.Format("Foo: {0}, Bar: {1}", foo, bar);
I always use the aliases when I'm coding, though there are a few things that don't make too much sense for the aliases.
as an example Convert.ToInt64 returns something that I would define as a long, which doesn't feel quite right but I'll still stick to aliases.
But a long is a 64-bit integer... not sure why that's confusing?
using WhyUseStringorstringWhenYouCanUseMegaString = System.String;
WhyUseStringorstringWhenYouCanUseMegaString awesome = "awesome";
But a long is a 64-bit integer... not sure why that's confusing?
It is for me when going back and forth between c# and c++ seeing as c++ treats a long as a 32-bit integer![]()