Blog - Title

  • 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

    Visual Studio "14" CTP Now Available

    • 23 Comments
    As announced today by Soma , we've just released the first CTP (Community Technology Preview) of the next version of Visual Studio. This is doubly-exciting as this is the first public release of a version of Visual Studio powered by "Roslyn" by default...
  • The C# Team

    Be Mindful of the References / 'using' / Manifest Relationship

    • 9 Comments
    Given that the .NET platform encourages binary reuse of types, it is commonplace to set references to external assemblies using the Visual Studio .NET Add Reference dialog box. Many programmers (especially those of the C(++) ilk) fear that adding unnecessary...
  • The C# Team

    Introduction to the Roslyn Scripting API

    • 9 Comments
    by Brian Rasmussen In this post we take a look at how the Roslyn Scripting API can enable applications to evaluate code at runtime. While this has been possible since the dawn of .NET through the use of Reflection, Lightweight Code Generation, CodeDom...
  • The C# Team

    No new C# and VB Language Features in VS 2013

    • 19 Comments
    As you can see in the VS2013 Preview , we have not added new language features to C# and Visual Basic in the next version of Visual Studio. I’d like to share our thinking on this. There are essentially two main reasons why we chose not to evolve...
  • 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 it possible to output the command-line used to build a project in Visual Studio?

    • 6 Comments
    Now that Whidbey has been out in Beta for more than a few months, it seems worth revisiting some frequently asked questions which have different (better?) answers now. In Everett (v7.1) the answer used to be No. However, in Whidbey (v8.0), the answer...
  • 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 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

    Are Generics in .NET like Templates in C++?

    • 9 Comments
    No. While Generic types do have a similar syntax to C++ templates, they are instantiated at runtime as opposed to compile time, and they can be reflected on via meta-data. Also, in Generics, member access on the type paramater is verified based on...
  • 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

    Using the Roslyn Syntax API

    • 3 Comments
    By Kevin Pilch-Bisson As promised back when we released the Roslyn CTP, here is the first of a series of blog posts that help explain the various parts of the Roslyn API. If you don’t have the Roslyn CTP, you can get it from our MSDN page , and install...
  • The C# Team

    Async CTP (SP1 Refresh)

    • 15 Comments
    By Jeremy Meng Visual Studio Async CTP (SP1 Refresh) is available now! You are welcome to download and try it out! Thanks to the new Async feature coming in Visual Basic and C# it has never been so easy to write asynchronous code. With the newly...
  • The C# Team

    Add Custom .NET Assemblies to the Add Reference Dialog

    • 15 Comments
    As you most likely know by now, the Add References dialog of Visual Studio .NET does not list each and every assembly on your machine, does not directly map to the Global Assembly Cache and does not list your custom assemblies. Typically this limitation...
  • The C# Team

    Why can't I use the same variable as an inner loop does?

    • 12 Comments
    Q: Why can't I do the following: namespace Bug { class Class1 { [ STAThread ] static void Main ( string [] args ) { for ( int i = 0; i < 100; i ++ ) { } int i = 0; } } } the compiler gives me an error...
  • The C# Team

    Why can't I have static and instance methods with the same name?

    • 12 Comments
    Q: Why can't I have static and instance methods with the same name? class Test { static void Process(); void Process(); void AmbiguousCaller() { Process(); } } there's no ambiguity, since the first can only be called through the type...
  • 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

    Why must attribute properties be read/write in C#?

    • 5 Comments
    Q: Why must attribute properties be read/write in C#? In the C# language, when you define an attribute class, you can define both constructor arguments and properties. For example: class MyAttribute: Attribute { string name; int number; public...
  • The C# Team

    Does the “LINQ to Objects” provider have built-in performance optimization?

    • 5 Comments
    Let’s start with the basics and maybe repeat some information that many of you already know. One of the most important concepts in LINQ performance and optimization is, of course, deferred execution. It simply means that when you declare a variable and...
  • The C# Team

    Start Coding for the Kinect

    • 3 Comments
    by Alan Berman I'm intrigued by all the interesting industry apps being developed for the Kinect. I started wondering how easy it is to start programming the Kinect using Visual Studio on a PC. It is very easy to get started, especially since the Kinect...
  • The C# Team

    Why does C#'s iterators feature spit out a class definition instead of a struct definition?

    • 1 Comments
    Q: Why does C#'s iterators feature spit out a class definition instead of a struct definition? The iterators feature in C# generates classes that implement the enumerators required. This is detailed in the C# Specification . Why doesn't it use structs...
  • The C# Team

    Roslyn CTP Introduces Interactive Code for C#

    • 2 Comments
    There's been a lot of posts on using the Roslyn CTP APIs for syntax trees, semantic binding, and IDE smart editor features. The Roslyn CTP also introduces a set of features for C# we refer to as "Interactive". These features won't be new to VB, but we...
  • The C# Team

    Why doesn't C# warn about unused methods?

    • 7 Comments
    Q: Why doesn't C# warn on unused methods? A: This is something that the C# compiler could do, subject to a few caveats: Virtual functions would have to be excluded Interface implementations wouldn have to be excluded You would get false...
  • The C# Team

    Obtain Type Information on the Fly using typeof

    • 2 Comments
    All .NET assemblies contain vivid type information which describes the structure of every internal and external type (this can be verified by loading an assembly into ildasm.exe and clicking the ctrl-m keystroke). On a related note, many methods in the...
Page 4 of 6 (138 items) «23456