Quantcast
Channel: 2,000 Things You Should Know About C# » null
Browsing all 8 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

#26 – Null Literal

The keyword null represents a null literal.  A null value indicates that a reference points to no object. Examples: object o1 = null; if (o1 == null) Console.WriteLine("Yup, it's null"); string s1 =...

View Article



Image may be NSFW.
Clik here to view.

#206 – Value Types Can’t Represent Null Values

A reference type variable can be set to point to an instance of the type that it represents, or it can be set to the null value.  The null value indicates that the object doesn’t point to anything....

View Article

Image may be NSFW.
Clik here to view.

#207 – Nullable Types

Because value types can’t normally represent null values, C# includes nullable types–types that can represent their normal range of values or represent a null value. Any value type can be used as a...

View Article

Image may be NSFW.
Clik here to view.

#477 – Full List of Escape Sequences for Character Literals

You can use one of several escape sequences within a character literal to represent a character that you can’t include directly in the literal. The full list of character literals includes: \’ – Single...

View Article

Image may be NSFW.
Clik here to view.

#588 – A Default Parameter Value Can Be Null

When defining optional parameters and providing a default value for the parameter, you can use a value of null for a reference-typed parameter.  null is actually the only valid default value that you...

View Article


Image may be NSFW.
Clik here to view.

#730 – Check for null Before Iterating Using foreach Statement

The foreach statement allows iterating through all items in a collection. List<string> dogs = new List<string>(); dogs.Add("Kirby"); dogs.Add("Jack"); foreach (string s in dogs)...

View Article

Image may be NSFW.
Clik here to view.

#1,009 – A String Can Be Null or Empty

A string variable can refer to a string that either contains characters, or an empty string.  Because string is a reference type, a variable of type string can also be assigned a value of null,...

View Article

Image may be NSFW.
Clik here to view.

#1,010 – Checking to See Whether a String is Null or Empty

An empty string and a null string are two different things.  In some cases, you’ll want to check to see whether a string is null or to see whether it is non-null yet empty. string bobsNickname =...

View Article

Browsing all 8 articles
Browse latest View live




Latest Images