null pointer : null « Language Basics « C# / C Sharp






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;
    }
}

 








Related examples in the same category