Sign in
Home
Library
Learn
Samples
Downloads
Support
Community
Forums
Blogs
from ideas to solutions
MSDN Blog Leaderboards
Most Active Contributors
Most Active Commentators
MSDN Blogs
The Latest Blog Posts
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
C# Frequently Asked Questions
What do I use instead of
addressof
?
Posted
over 9 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 9 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 9 years ago
by
CSharpFAQ
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]
C# Frequently Asked Questions
What's the equivalent of
Nothing
?
Posted
over 9 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
How do I tell C# what kind of literal number I want?
Posted
over 9 years ago
by
CSharpFAQ
5
Comments
If you need to tell C# that you want it to treat a literal as a particular type of number, you may do so by adding a number type suffix at the end of the literal you provide. For example: 1u; // An unsigned int 1l; // A signed long 1ul;...
C# Frequently Asked Questions
How do I use an alias for a namespace or class?
Posted
over 9 years ago
by
CSharpFAQ
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: ...
C# Frequently Asked Questions
What's the difference between
override
and
new
?
Posted
over 9 years ago
by
CSharpFAQ
18
Comments
This is all to do with polymorphism. When a virtual method is called on a reference, the actual type of the object that the reference refers to is used to decide which method implementation to use. When a method of a base class is overridden in a...
jaybaz [MS] WebLog
Edit and Continue vs. Einstein
Posted
over 9 years ago
by
MSDNArchive
6
Comments
Continuing the discussion with Einstein , the prototypcial C++ developer. Einstein often creates software solutions to some pretty complex problems. He spends a lot of time trying thinking about different approaches to the problem, and tries to pick...
C# Frequently Asked Questions
Why doesn't C# have checked exceptions?
Posted
over 9 years ago
by
CSharpFAQ
5
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...
C# Frequently Asked Questions
What's the difference between cast syntax and using the
as
operator?
Posted
over 9 years ago
by
CSharpFAQ
4
Comments
Using the as operator differs from a cast in C# in three important ways: It returns null when the variable you are trying to convert is not of the requested type or in it's inheritance chain, instead of throwing an exception. It can...
C# Frequently Asked Questions
What's the difference between
string
and
System.String
?
Posted
over 9 years ago
by
CSharpFAQ
10
Comments
C# defines a number of aliases for CLR types. They may be used interchangably, and even mixed together, e.g. string x = new System.String(' ', 5); . These are the aliases defined: Alias CLR type string System.String ...
C# Frequently Asked Questions
What's the difference between an event and a delegate?
Posted
over 9 years ago
by
CSharpFAQ
1
Comments
Put simply, an event gives more limited access than a delegate. If an event is made public, code in other classes can only add or remove handlers for that event; they can't necessarily fire it, find out all the handlers for it, or remove handlers...
Page 31256 of 31,845 (382,139 items)
«
31254
31255
31256
31257
31258
»