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
Is it possible to output the command-line used to build a project in Visual Studio?
Posted
over 9 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
Preprocess Win32 Messages through Windows Forms
Posted
over 9 years ago
by
CSharpFAQ
11
Comments
In the unmanaged world, it was quite common to intercept Win32 messages as they were plucked off the message queue. In that rare case in which you wish to do so from a managed Windows Forms application, your first step is to build a helper class which...
C# Frequently Asked Questions
Be Mindful of the References / 'using' / Manifest Relationship
Posted
over 9 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
Activate 'Full Screen Mode' During your Source Code Editing
Posted
over 9 years ago
by
CSharpFAQ
11
Comments
Okay, I admit this is a rather lame tip which can hardly qualify as 'insightful', however this is one of my favorite features of Visual Studio .NET (as well as previous editions of the Visual Studio product line) which many folks are (surprisingly) unaware...
C# Frequently Asked Questions
Leverage the C# Preprocessor
Posted
over 9 years ago
by
CSharpFAQ
7
Comments
Like other languages in the C-family, C# supports a set of 'preprocessor' directives , most notably #define , #if and #endif (technically, csc.exe does not literally have a preprocessor as these symbols are resolved at the lexical analysis phase, but...
C# Frequently Asked Questions
Avoiding Type Name-Clashes using 'using'
Posted
over 9 years ago
by
CSharpFAQ
10
Comments
You are already aware that the C# using keyword allows you to supply hints to the compiler regarding the fully qualified name of the types within a given *.cs file. However, what you may not know is that the using keyword also allows you to build aliases...
C# Frequently Asked Questions
Build 'Consistent' .NET assemblies with FxCop
Posted
over 9 years ago
by
CSharpFAQ
1
Comments
The term 'best practices' sends chills up the spines of many people. Reason being, what is 'best' for one is 'horrible' for another. However, if you are interested in ensuring that your custom .NET assemblies are in-sync with the coding guidelines proposed...
C# Frequently Asked Questions
Simplified Interface Implementation a la VS .NET 2003
Posted
over 9 years ago
by
CSharpFAQ
2
Comments
Another helpful feature of VS .NET 2003 has to do with the implementation of interface types. As you know, when a class or structure agrees to implement a given interface, it must implement all of the members. Assume you wish to support an interface containing...
C# Frequently Asked Questions
Simplified Event Handling a la VS .NET 2003
Posted
over 9 years ago
by
CSharpFAQ
3
Comments
Working with events under the .NET platform requires you to be aware of a number of details. For example, if you know the name of the event you wish to handle, you must then know the name of the related delegate type. Once you know that much, you must...
C# Frequently Asked Questions
Integrate ildasm.exe into VS .NET 2002
Posted
over 9 years ago
by
CSharpFAQ
1
Comments
VS .NET allows you to add any number of external tools to the Tools menu. One very helpful technique is to configure ildasm.exe to automatically load up the current assembly being compiled. While VS .NET 2003 sets this up automatically, VS .NET 2002 may...
C# Frequently Asked Questions
Add Custom .NET Assemblies to the Add Reference Dialog
Posted
over 9 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
Leverage C# Response Files at the Command Line
Posted
over 9 years ago
by
CSharpFAQ
3
Comments
Although I'd bet most of you make use of VS .NET as opposed to the raw command line complier, csc.exe can be quite useful in a number of circumstances. However, few of us enjoy typing lengthy command line flags such as: csc /r: MyAsm.dll;MyOtherAsm...
C# Frequently Asked Questions
Be Aware of wincv.exe
Posted
over 9 years ago
by
CSharpFAQ
7
Comments
When you install the .NET SDK / VS.NET, you are provided with numerous stand alone programming tools, one of which is named wincv.exe ( Windows Class Viewer ). Many developers are unaware of wincv.exe, as it is buried away under the C:\Program Files\Microsoft...
C# Frequently Asked Questions
Utilize the Server Explorer
Posted
over 9 years ago
by
CSharpFAQ
0
Comments
Visual Studio .NET provides a very interesting view of the world named the Server Explorer (which can be activated from the View menu). While you may already be aware many of these items can be opened within VS .NET for editing (for example, opening a...
C# Frequently Asked Questions
Obtain Type Information on the Fly using typeof
Posted
over 9 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
Interacting with overloaded operators from overloaded operator challenged languages
Posted
over 9 years ago
by
CSharpFAQ
3
Comments
Like the C++ language, C# allows you to overload operators for your custom types. For example, assume you have a structure named MyPoint which has overloaded the plus operator. If this is the case, you can 'add' two MyPoints as so: // Add two MyPoint...
C# Frequently Asked Questions
How to keep a local variable in scope across a try and catch block?
Posted
over 9 years ago
by
CSharpFAQ
18
Comments
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...
C# Frequently Asked Questions
Does C# support variable arguments (vararg's) on methods?
Posted
over 9 years ago
by
CSharpFAQ
4
Comments
There was a suggestion/question on the Product Feedback site for VS2005 that suggested that the params keyword may not be that well understood. The params keyword can be applied on a method parameter that is an array. When the method is invoked, the...
C# Frequently Asked Questions
What is the equivalent to regsvr32 in .NET?
Posted
over 9 years ago
by
CSharpFAQ
11
Comments
Where you once used Regsvr32 on unmanaged COM libraries, you will now use Regasm on managed .NET libraries. “ Regsvr32 is the command-line tool that registers .dll files as command components in the registry“ “Regasm.exe, the...
C# Frequently Asked Questions
Are Generics in .NET like Templates in C++?
Posted
over 9 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
Why does my switch statement works differently?
Posted
over 9 years ago
by
CSharpFAQ
5
Comments
C# does not support an explicit fall through for case blocks (unless the block is empty) For an explanation of why, see Why is the C# switch statement designed to not allow fall through, but still require a break? on MSDN The following code is not...
C# Frequently Asked Questions
Why does C#'s iterators feature spit out a class definition instead of a struct definition?
Posted
over 9 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
How can I run another application or batch file from my Visual C# .NET code?
Posted
over 9 years ago
by
CSharpFAQ
32
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...
C# Frequently Asked Questions
How do I cast a string to an int, float, double, etc?
Posted
over 9 years ago
by
CSharpFAQ
16
Comments
You can use the Convert class or the Parse method of the built-in type you are casting to. i.e. string myStr = "123"; int myParsedInt = Int32.Parse(myStr); int myConvertedInt = Convert.ToInt32(myStr); This example uses the int type, but you can also...
C# Frequently Asked Questions
How are return values from a delegate handled?
Posted
over 9 years ago
by
CSharpFAQ
4
Comments
Q: How are multiple return values from a delegate handled? In C#, it's possible to write a delegate such as: delegate double GetResult(params double p); If there is more than one method on this delegate, there are multiple return values. A...
Page 3 of 5 (121 items)
1
2
3
4
5