Sign In
C# Frequently Asked Questions
The C# team posts answers to common questions and describes new language features
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Options
Email Blog Author
RSS for posts
Atom
RSS for comments
OK
Search
Advanced search options...
Search In:
Everything
Blogs
Forums
People
Groups
Places
Pages
Date range:
All Time
Last Year
Last 6 Months
Last 3 Months
Last Month
Last Week
Last Two Days
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
Archive
Archives
February 2012
(2)
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)
C#/VB.NET Equivalents
MSDN Blogs
>
C# Frequently Asked Questions
>
C#/VB.NET Equivalents
Posts
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
C# Frequently Asked Questions
New Async Programming Videos
Posted
5 months ago
by
CSharpFAQ
2
Comments
Some great new video's on MSDN showing how to do async programming using the Async CTP. http://msdn.microsoft.com/en-us/vstudio/hh378091.aspx There are different versions of video's for both VB and C#. This is a great opportunity to see the power...
C# Frequently Asked Questions
How to keep a local variable in scope across a try and catch block?
Posted
over 8 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
Where can I get a full comparison between C# and VB.NET?
Posted
over 8 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
Is there an equivalent of
MyClass
?
Posted
over 8 years ago
by
CSharpFAQ
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]
C# Frequently Asked Questions
What do I use instead of
addressof
?
Posted
over 8 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
How do I get the rightmost part of a string, as with the VB
Right
function?
Posted
over 8 years ago
by
CSharpFAQ
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...
C# Frequently Asked Questions
What are the equivalents of
Me
and
MyBase
?
Posted
over 8 years ago
by
CSharpFAQ
0
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]
C# Frequently Asked Questions
What's the equivalent of
Nothing
?
Posted
over 8 years ago
by
CSharpFAQ
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]
C# Frequently Asked Questions
Why doesn't C# have VB.NET's 'with' operator?
Posted
over 8 years ago
by
CSharpFAQ
36
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...
C# Frequently Asked Questions
What are the advantages of C# over VB.NET and vice versa?
Posted
over 8 years ago
by
CSharpFAQ
41
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...
Page 1 of 1 (10 items)