Csharp/C Sharp/Language Basics/null

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

null pointer

 
using System;
public class MainClass {
    public static void Main(string[] args) {
        MyObject localObject = new MyObject();
        Console.WriteLine("localObject.n is {0}", localObject.n);
        if (localObject.nextObject == null) {
            Console.WriteLine("localObject.nextObject is null");
        }
    }
    public class MyObject {
        internal int n;
        internal MyObject nextObject;
    }
}