Generic type and ref, out

Generic type can have ref and out modifier.

 
using System;

class Test
{
    static void print<T>(ref T t)
    {
        Console.WriteLine(t);
    }


    static void Main()
    {
        string str = "asdf";
        print(ref str);
    }
}

The output:


asdf
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.