Blog - Title

  • The C# Team

    Ask a FAQ Question

    • 197 Comments
    Do you have a FAQ about: The C# Language or compiler The C# IDE The Visual Studio debugger Reply to this post, and your question will be added to our list to be answered. Of course, depending on the nature of your comment, and the volume...
  • The C# Team

    What is the difference between “dynamic” and “object” keywords?

    • 131 Comments
    Let’s take a quick look at the object keyword first. I’m not going to talk a lot about it because it’s been around since C# 1.0. This keyword is nothing more than a shortcut for System.Object , which is the root type in the C# class hierarchy. (However...
  • The C# Team

    Parallel Programming in .NET Framework 4: Getting Started

    • 94 Comments
    With this post I want to start a series devoted to the new parallel programming features in .NET Framework 4 and introduce you the Task Parallel Library (TPL) . Update. The list of posts in this series: Getting Started (this post) Task Schedulers and...
  • The C# Team

    Dynamic in C# 4.0: Introducing the ExpandoObject

    • 73 Comments
    You have probably already heard about the new dynamic feature in C# 4.0 and how it is used to support COM interop. If you haven't, I strongly recommend reading the following MSDN articles: Using Type dynamic and How to: Access Office Interop Objects by...
  • The C# Team

    Get Ready For C# 4.0!

    • 70 Comments
    Visual Studio 2010 is here! And of course this means that C# 4.0 is also here. Let’s do a quick review of the new language features added in this release. Dynamic The dynamic keyword is a key feature of this release. It closes the gap between dynamic...
  • The C# Team

    New Features in C# 6

    • 59 Comments
    C# 6 is the version of C# that ships with VS 2015 Preview . The philosophy behind this version is straightforward: improve simple everyday coding scenarios, without adding much conceptual baggage. The features should make code lighter without making the...
  • The C# Team

    C# 4.0 PowerPoint Presentations

    • 47 Comments
    Alexandru Ghiondea from the C# team created an excellent deck of slides that he used at Microsoft Days 2010 in Bulgaria. The C# team reused the deck several times for User Groups' presentations and talks. If you are planning a talk at your User Group...
  • The C# Team

    Why did I receive the error: "The type or namespace '<namespace name>' does not exist in the class or namespace '<parent namespace>' (are you missing an assembly reference?)"

    • 43 Comments
    You need to add a reference in your project to an assembly where that namespace is defined. If you are using VS.NET: 1. Right click on the References folder on your project. 2. Select Add Reference. 3. Select the .NET tab (or select the Browse button...
  • The C# Team

    What are the advantages of C# over VB.NET and vice versa?

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

    Throwing the Big Switch on Roslyn (Matt Gertz, VS Managed Languages Development Manager)

    • 42 Comments
    So, the entryway to my house has eight light switches along the wall. Two of them control the porch lights, and another two work the same entryway light (despite the switches being only a couple of feet apart). I haven’t the foggiest idea what the...
  • The C# Team

    Why doesn't C# have VB.NET's 'with' operator?

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

    Does C# have default parameters?

    • 39 Comments
    Update: Named and optional (default) parameters are available starting from C# 4.0. For more information, see Named and Optional Arguments (C# Programming Guide) . In languages such as C++, a default value can be included as part of the method...
  • The C# Team

    Why doesn't C# support #define macros?

    • 37 Comments
    In C++, I can define a macro such as: #define PRODUCT(x, y, z) x * y * z and then use it in code: int a = PRODUCT(3, 2, 1); C# doesn't allow you to do this. Why? There are a few reasons why. The first is one of readability. One of our...
  • The C# Team

    Why aren't reference types polymorphic?

    • 35 Comments
    Q: Why aren't reference types polymorphic? A: Consider the following code: using System; class Dog { public string Name; } class Test { public static void Swap(ref object a, ref object b) { object temp; temp = a; a = b; b = temp; } public static...
  • The C# Team

    Covariance and Contravariance FAQ

    • 35 Comments
    In this post I’ll try to answer the most common questions I find on forums and in documentation feedback about C# covariance and contravariance. It’s a big topic for a single blog post, so expect to see a lot of “more information” links. Special thanks...
  • The C# Team

    How can I run another application or batch file from my Visual C# .NET code?

    • 34 Comments
    Posted by: Duncan Mackenzie , MSDN This post applies to Visual C# .NET 2002/2003 Suppose you want to run a command line application, open up another Windows program, or even bring up the default web browser or email program... how can you do this from...
  • The C# Team

    How can I update my user interface from a thread that did not create it?

    • 34 Comments
    When performing any action on a control which requires the updating of a user interface element (e.g. setting the Text property on almost any class derived from Control, updating the data source behind a DataGrid), these operations MUST take place on...
  • The C# Team

    How do C# generics compare to C++ templates?

    • 28 Comments
    Q: How do C# generics compare to C++ templates? A: This is really a fairly complex topic. Anders has touched on it in an interview . I should state at the outset that the goals of generics are not the same as the goals of templates. There are...
  • The C# Team

    Crystal Reports for Visual Studio 2010

    • 28 Comments
    Crystal Reports has been a part of Visual Basic since 1993, and a part of Visual Studio since its first release in 2002. Crystal Reports has been a very successful component of these products. With the release of Visual Studio 2010, SAP and Microsoft...
  • The C# Team

    Why doesn't C# support multiple inheritance?

    • 27 Comments
    This answer is from Chris Brumme via the following post . I've copied the text in here in case the post disappears. *** There are a number of reasons we don't implement Multiple Implementation Inheritance directly. (As you know, we support Multiple...
  • The C# Team

    Why doesn't C# have a power operator?

    • 27 Comments
    Some languages provide a power operator, so one can write something like: float result = value^2; rather than having to resort to calling. We don't have one in C#. It would be possible to add a power operator to the language, but performing this...
  • The C# Team

    Converting a VBA Macro to C# 4.0

    • 26 Comments
    I've talked a lot about improved COM interop in C# 4.0 and how much easier it is now to work with Office applications. This time I want to share some tips and tricks on how you can convert Visual Basic for Applications (VBA) macros to C# 4.0 by using...
  • The C# Team

    New IDE Features in Visual Studio 2010 for C# Developers

    • 26 Comments
    After a quick review of C# language features , let’s do the same for the IDE improvements. So, what’s in there for C# developers? Generate From Usage This feature greatly improves Visual Studio support for test-driven development (TDD) . However...
  • The C# Team

    Parallel Programming: Task Cancellation

    • 26 Comments
    In this post, which is the third one in my parallel programming introduction series, I want to show how you can cancel parallel operations when working with the Task Parallel Library (TPL) . I’m going to modify the program that I started in the previous...
  • The C# Team

    When should I use == and when should I use Equals?

    • 25 Comments
    The Equals method is just a virtual one defined in System.Object , and overridden by whichever classes choose to do so. The == operator is an operator which can be overloaded by classes, but which usually has identity behaviour. For reference...
Page 1 of 6 (137 items) 12345»