C# string and String

As I’m digging further into my C# for VB6 programmers talk that I am preparing for Code Camp and also DevConnections, I noticed something funny – that case-sensitive C# doesn’t seem to care if you use String or string – while it cares plenty if you try to use “Int” or “Bool”, etc. 

I realized though that it is really because string is the C# type and System.String is the .NET type, so they both are okay. So byte/Byte are both okay but you can’t get away with int/Int32 or bool/Boolean. The funny thing is that when I am coding in VB, I try to use the framework types. I always use Int32, never Integer. But I was trying to be a cool C# coder, so I was using the C# types instead. Go figure! Actually in VB, Integer is more work than Int32, but in C# int is faster than Int32. So that’s probably my good excuse, eh? Anyway, these seem like silly things, but definitely will make a VB coder stop and think for a minute which is why I’m doing my best to try to save them a few steps!

This talk is almost just as easily C# for VB.NET programmers, except that since there were syntax changes from VB6 to VB.NET, I will be incorporating the VB6 perspective as well.

http://www.AcehAid.org

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

One thought on “C# string and String

Leave a Reply to C# string and String Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.