from ideas to solutions

The Latest Blog Posts
  • The C# Team

    Where can I get a full comparison between C# and VB.NET?

    • 6 Comments
    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...
  • The C# Team

    Is there an equivalent of MyClass?

    • 8 Comments
    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]
  • The C# Team

    What do I use instead of addressof?

    • 1 Comments
    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...
  • The C# Team

    How do I get the rightmost part of a string, as with the VB Right function?

    • 10 Comments
    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...
  • The C# Team

    What are the equivalents of Me and MyBase?

    • 1 Comments
    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]
  • The C# Team

    What's the equivalent of Nothing?

    • 4 Comments
    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]
  • The C# Team

    How do I tell C# what kind of literal number I want?

    • 5 Comments
    If you need to tell C# that you want it to treat a literal as a particular type of number, you may do so by adding a number type suffix at the end of the literal you provide. For example: 1u; // An unsigned int 1l; // A signed long 1ul;...
  • The C# Team

    How do I use an alias for a namespace or class?

    • 6 Comments
    Use the using directive to create an alias for a long namespace or class name. You can then use it anywhere you normally would have used that class or namespace. The using alias has a scope within the namespace you declare it in. Sample code: ...
  • The C# Team

    What's the difference between override and new?

    • 19 Comments
    This is all to do with polymorphism. When a virtual method is called on a reference, the actual type of the object that the reference refers to is used to decide which method implementation to use. When a method of a base class is overridden in a...
  • jaybaz [MS] WebLog

    Edit and Continue vs. Einstein

    • 6 Comments
    Continuing the discussion with Einstein , the prototypcial C++ developer. Einstein often creates software solutions to some pretty complex problems. He spends a lot of time trying thinking about different approaches to the problem, and tries to pick...
  • The C# Team

    Why doesn't C# have checked exceptions?

    • 11 Comments
    Checked exceptions are a very hotly debated topic in some circles, particularly for experienced Java developers moving to, or additionally learning, C#. Here are some resources that discuss the issue in depth: The Trouble With Checked Exceptions...
  • The C# Team

    What's the difference between cast syntax and using the as operator?

    • 4 Comments
    Using the as operator differs from a cast in C# in three important ways: It returns null when the variable you are trying to convert is not of the requested type or in it's inheritance chain, instead of throwing an exception. It can...
Page 33500 of 34,090 (409,069 items) «3349833499335003350133502»