public void Demonstrate() { Sample s = new Sample(); s.DoSomething('z'); s.DoSomething((byte)5); s.DoSomething(6.3333d); s.DoSomething(777); GenericA xa = s.GetSomething <GenericA>(); GenericB xb = s.GetSomething <GenericB>(); }
public void IsIEnumerableOfType_Generic() { var source = new GenericB <C>[] { new GenericB <C>(), new TestClass() }; //var result = source.OfType<GenericB<C>>(); var result = source.OfType((GenericType)typeof(GenericB <>)); Assert.That(result, Is.EqualTo(source)); }
public void IsOfType_Generic2() { var obj = new GenericB <C>(); Assert.IsTrue(obj.IsSubclassOf((GenericType)typeof(GenericB <C>))); Assert.IsTrue(obj.IsSubclassOf((GenericType)typeof(GenericB <B>))); Assert.IsTrue(obj.IsSubclassOf((GenericType)typeof(GenericB <A>))); Assert.IsTrue(obj.IsSubclassOf((GenericType)typeof(GenericA <C>))); Assert.IsTrue(obj.IsSubclassOf((GenericType)typeof(GenericA <B>))); Assert.IsTrue(obj.IsSubclassOf((GenericType)typeof(GenericA <A>))); Assert.IsTrue(obj.IsSubclassOf(new GenericType(typeof(GenericB <>)))); Assert.IsTrue(obj.IsSubclassOf(new GenericType(typeof(GenericA <>)))); }
public void Set(GenericB t2Value) { PropT2 = t2Value; }
public HaveManyGenericTypesClosed(GenericB t2Value, GenericA t1Value) { PropT2 = t2Value; PropT1 = t1Value; }
public HaveManyGenericTypesClosed(GenericB t2Value) { PropT2 = t2Value; }