Browse by Tags

Tagged Content List
  • Blog Post: New Async Programming Videos

    Some great new video's on MSDN showing how to do async programming using the Async CTP. http://msdn.microsoft.com/en-us/vstudio/hh378091.aspx There are different versions of video's for both VB and C#. This is a great opportunity to see the power of the new Async languages featuresand follow through...
  • Blog Post: How to keep a local variable in scope across a try and catch block?

    The following code won't work, because conn goes out of scope before you enter the catch block. try { Connection conn = new Connection(); conn.Open(); } catch { if (conn != null ) conn.Close(); } The fix is simple - just declare conn before entering the try block Connection conn = null ; // Note the...
  • Blog Post: Where can I get a full comparison between C# and VB.NET?

    Microsoft provides a very full language equivalents page which compares not only C# and VB.NET, but also other languages targeted at the .NET framework. It looks at the equivalent concepts, keywords, types, operators etc. A very valuable resource when you're trying to read or write code in a...
  • Blog Post: Is there an equivalent of MyClass?

    No, C# doesn't have an equivalent of VB.NET's MyClass keyword. If you want to guarantee not to call an overridden version of a method, you need to make it non-virtual in the first place. [Author: Jon Skeet]
  • Blog Post: What do I use instead of addressof?

    To create delegate instances in C#, you just specify the delegate type, the method, and (if you want to create a delegate targetting a different instance or type from the current one) the target. For instance, each of these creates a ThreadStart delegate: ThreadStart x1 = new ThreadStart(SomeInstanceMethod...
  • Blog Post: How do I get the rightmost part of a string, as with the VB Right function?

    Use String.Substring . Assuming that x is a string of length at least n , to get the last n characters, you would use x.Substring(x.Length-n) . Note that the above assumes that the string is at least n characters long. For a more robust version, you might use something like: x.Length . ...
  • Blog Post: What are the equivalents of Me and MyBase?

    Me in C# is this , and MyBase in C# is base . To access normal members, just use this.memberName or base.memberName . For information about chaining constructors together, see my article on constructors . [Author: Jon Skeet]
  • Blog Post: What's the equivalent of Nothing?

    For reference types, the equivalent of VB's Nothing is C#'s null . For value types, it's the default value - 0 , false , etc. [Author: Jon Skeet]
  • Blog Post: Why doesn't C# have VB.NET's 'with' operator?

    Many people, including the C# language designers, believe that 'with' often harms readability, and is more of a curse than a blessing. It is clearer to declare a local variable with a meaningful name, and use that variable to perform multiple operations on a single object, than it is to have a block...
  • Blog Post: What are the advantages of C# over VB.NET and vice versa?

    The choice between C# and VB.NET is largely one of subjective preference. Some people like C#'s terse syntax, others like VB.NET's natural language, case-insensitive approach. Both have access to the same framework libraries. Both will perform largely equivalently (with a few small differences...
Page 1 of 1 (10 items)