Sign in
MSDN Blogs
Microsoft Blog Images
More ...
MSDN Blogs
>
C# Frequently Asked Questions
Server & Tools Blogs
>
Developer Tools Blogs
>
C# Frequently Asked Questions
Executive Bloggers
S. Somasegar
Brian Harry
Scott Guthrie
Jason Zander
Visual Studio
Visual Studio
Blend
LightSwitch
Line of Business Apps by Beth Massi
Setup & Install by Heath Stewart
Application Lifecycle Management
Visual Studio ALM
Team Foundation Service
Languages
Visual Basic
Visual C#
Visual C++
Visual F#
JavaScript
.NET Framework
.NET Framework
.NET Parallel Programming
ADO.NET (Managed Providers, DataSet & EF)
ASP.NET by Scott Hanselman
Base Class Library (BCL)
Silverlight
WCF Data Services
Workflow
Platform Development
Internet Explorer
Apps for Office and SharePoint 2013
SharePoint
Office
Web
Windows 8
Windows Store
Windows Azure
Windows Phone
C# Frequently Asked Questions
The C# team posts answers to common questions and describes new language features
Subscribe
Comments
Contact
Menu
Blog Home
Atom
Translate this page
Powered by
Microsoft® Translator
Live Now on Developer Tools Blogs
Tags
.NET Framework
.NET Framework 4
async
asynchronous programming
await
C#
C# 3.0
C# 4.0
C# compiler
C#/VB.NET Equivalents
DLR
dynamic language runtime
expression trees
IDE
parallel-processing
parallel-programming
reflection
roslyn
Task Parallel Library
Tips
TPL
Visual Studio
Visual Studio 2010
Visual Studio Async CTP
WPF
More
▼
Less
▲
Related resources
Visual Studio Developer Center
Visual Studio Product Website
Archives
Archives
September 2012
(1)
June 2012
(2)
April 2012
(1)
February 2012
(3)
January 2012
(2)
December 2011
(1)
November 2011
(3)
October 2011
(1)
August 2011
(2)
April 2011
(1)
March 2011
(1)
February 2011
(1)
November 2010
(1)
October 2010
(1)
September 2010
(1)
August 2010
(1)
July 2010
(2)
June 2010
(2)
May 2010
(1)
April 2010
(2)
March 2010
(1)
February 2010
(1)
January 2010
(2)
November 2009
(1)
October 2009
(2)
September 2009
(1)
March 2009
(1)
January 2009
(1)
October 2006
(2)
March 2006
(3)
February 2005
(1)
December 2004
(4)
November 2004
(1)
October 2004
(15)
August 2004
(3)
July 2004
(3)
June 2004
(1)
May 2004
(8)
April 2004
(4)
March 2004
(36)
More
▼
Less
▲
Blog - Title
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
C# Frequently Asked Questions
Parallel Programming: Task Schedulers and Synchronization Context
Posted
over 3 years ago
by
Alexandra Rusina
20
Comments
Thanks to everyone who provided feedback on my previous post Parallel Programming in .NET Framework 4: Getting Started . As promised, I am continuing the series. This time, let’s go a little bit deeper and talk about task schedulers , synchronization...
C# Frequently Asked Questions
Parallel Programming in .NET Framework 4: Getting Started
Posted
over 3 years ago
by
Alexandra Rusina
83
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...
C# Frequently Asked Questions
New IDE Features in Visual Studio 2010 for C# Developers
Posted
over 3 years ago
by
Alexandra Rusina
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...
C# Frequently Asked Questions
Get Ready For C# 4.0!
Posted
over 3 years ago
by
Alexandra Rusina
69
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...
C# Frequently Asked Questions
Crystal Reports for Visual Studio 2010
Posted
over 3 years ago
by
CSharpFAQ
25
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...
C# Frequently Asked Questions
How can I get objects and property values from expression trees?
Posted
over 3 years ago
by
Alexandra Rusina
4
Comments
This is a follow-up to the Getting Information About Objects, Types, and Members with Expression Trees post, so I would recommend that you read that one first. Among other code examples in that blog post, I demonstrated how you can get a property name...
C# Frequently Asked Questions
Covariance and Contravariance FAQ
Posted
over 3 years ago
by
Alexandra Rusina
32
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...
C# Frequently Asked Questions
What is the difference between “dynamic” and “object” keywords?
Posted
over 3 years ago
by
Alexandra Rusina
127
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...
C# Frequently Asked Questions
Getting Information About Objects, Types, and Members with Expression Trees
Posted
over 3 years ago
by
Alexandra Rusina
16
Comments
Starting with C# 3.0 and Visual Studio 2008, you can use expression trees to get information about objects, types, and members. In this post I’m going to show some examples and explain what benefits you can get by using this technique. If you are not...
C# Frequently Asked Questions
Debugging Expression Trees in Visual Studio 2010
Posted
over 4 years ago
by
Alexandra Rusina
23
Comments
First of all, let’s take a look at the example from one of my previous posts . It creates an expression tree for calculating the factorial of a number. ParameterExpression value = Expression .Parameter( typeof ( int ), "value" ); ParameterExpression...
C# Frequently Asked Questions
Dynamic in C# 4.0: Creating Wrappers with DynamicObject
Posted
over 4 years ago
by
Alexandra Rusina
16
Comments
In the previous post I showed how you can use the new dynamic feature and the ExpandoObject class to add and remove properties at run time, and how this can make your code more readable and flexible than code written with LINQ to XML syntax. But there...
C# Frequently Asked Questions
Dynamic in C# 4.0: Introducing the ExpandoObject
Posted
over 4 years ago
by
Alexandra Rusina
71
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...
C# Frequently Asked Questions
Generating Dynamic Methods with Expression Trees in Visual Studio 2010
Posted
over 4 years ago
by
Alexandra Rusina
21
Comments
Expression trees first appeared in Visual Studio 2008, where they were mainly used by LINQ providers. You can use expression trees to represent code in a tree-like format, where each node is an expression. You can also convert expression trees into compiled...
C# Frequently Asked Questions
How to use LINQ methods to compare objects of custom types
Posted
over 4 years ago
by
CSharpFAQ
10
Comments
LINQ provides a convenient syntax and many useful methods for operating with collections of objects. However, to be correctly processed by LINQ comparison methods such as Distinct or Intersect , a type must satisfy certain requirements. Let’s take...
C# Frequently Asked Questions
Does the “LINQ to Objects” provider have built-in performance optimization?
Posted
over 4 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
How do I send out simple debug messages to help with my debugging?
Posted
over 7 years ago
by
CSharpFAQ
5
Comments
Visual Studio offers tons of useful debugging features and allows you to step through your code line-by-line. However, there are times when you don’t want to step through your application, but want to make it output simple text strings with variable values...
C# Frequently Asked Questions
How do I calculate a MD5 hash from a string?
Posted
over 7 years ago
by
CSharpFAQ
14
Comments
It is a common practice to store passwords in databases using a hash. MD5 (defined in RFC 1321 ) is a common hash algorithm, and using it from C# is easy. Here’s an implementation of a method that converts a string to an MD5 hash, which is a 32-character...
C# Frequently Asked Questions
How do I play default Windows sounds?
Posted
over 7 years ago
by
CSharpFAQ
3
Comments
Sometimes, you might want to make your application a bit more audible. If you are using .NET 2.0, you can utilize the new System.Media namespace and its SystemSound and SystemSounds classes. The SystemSounds class contains five static properties that...
C# Frequently Asked Questions
How can I easily log a message to a file for debugging purposes?
Posted
over 7 years ago
by
CSharpFAQ
12
Comments
Often, you need a way to monitor your applications once they are running on the server or even at the customer site -- away from your Visual Studio debugger. In those situations, it is often helpful to have a simple routine that you can use to log messages...
C# Frequently Asked Questions
How can I speed up hashtable lookups with struct object as keys?
Posted
over 7 years ago
by
CSharpFAQ
22
Comments
When you have struct objects as the key in a hashtable, the lookup operation of the hashtable performs miserably. This can be attributes to the GetHashCode() function which is used internally to do the lookup. If a struct contains only simple value...
C# Frequently Asked Questions
Where can I find design and coding guidelines for .NET?
Posted
over 8 years ago
by
CSharpFAQ
5
Comments
tipu_77 asked "What are microsoft suggested naming conventions in C#?" The .NET Framework Team collects their recommendations at their GotDotNet community site . which points to a fairly comprehensive MSDN page Design Guidelines for Class Library Developers...
C# Frequently Asked Questions
What does the /target: command line option do in the C# compiler?
Posted
over 9 years ago
by
CSharpFAQ
5
Comments
All the /target: options except module create .NET assemblies. Depending on the option, the compiler adds metadata for the operating system to use when loading the portable executable (PE) file and for the runtime to use in executing the contained assembly...
C# Frequently Asked Questions
What is the difference between const and static readonly?
Posted
over 9 years ago
by
CSharpFAQ
10
Comments
The difference is that the value of a static readonly field is set at run time, and can thus be modified by the containing class, w hereas the value of a const field is set to a compile time constant. In the static readonly case, the containing class...
C# Frequently Asked Questions
How do I create a constant that is an array?
Posted
over 9 years ago
by
CSharpFAQ
8
Comments
Strictly speaking you can't, since const can only be applied to a field or local whose value is known at compile time. In both the lines below, the right-hand is not a constant expression (not in C#). const int [] constIntArray = newint [] {2...
C# Frequently Asked Questions
How do I get and set Environment variables?
Posted
over 9 years ago
by
CSharpFAQ
6
Comments
Use the System.Environment class. Specifically the GetEnvironmentVariable and SetEnvironmentVariable methods. Admitedly, this is not a question specific to C#, but it is one I have seen enough C# programmers ask, and the ability to set environment variables...
Page 2 of 5 (121 items)
1
2
3
4
5