示例#1
0
        public void Value_should_be_set_implicitly()
        {
            var value = "Test";
            SomeGenericClass <string> result = value;

            Assert.Equal("Test", result.Value);
        }
示例#2
0
    static void Main(string[] args)
    {
        var sgc  = new SomeGenericClass <string>("asdf");
        var sgc2 = new SomeGenericClass <int>(1);
        var sgc3 = new SomeNonGenericChild("asdf2");

        Console.ReadKey();
    }
示例#3
0
        protected override void ExecuteInternal()
        {
            ToString();
            FirstMethod();

            var generic1 = new SomeGenericClass <int>();
            var generic2 = new SomeGenericClass <string>();
            var generic3 = new SomeGenericClass <object>();

            generic1.Foo();
            generic2.Foo();

            generic1.SomeGenericMethod <int>();
            generic1.SomeGenericMethod <string>();
            generic2.SomeGenericMethod <object>();
            generic2.SomeGenericMethod <string>();
            generic3.SomeGenericMethod <string>();

            var nonGeneric = new SomeClassWithGenericMethod();

            nonGeneric.Foo <int>();
            nonGeneric.Foo <string>();
        }
 static void Main(string[] args)
 {
     SomeGenericClass <int>    foo = new SomeGenericClass <int>();
     SomeGenericClass <string> bar = new SomeGenericClass <string>();
     SomeGenericClass <Baz>    baz = new SomeGenericClass <Baz>();
 }