Gen.InstVerify C# (CSharp) Method

InstVerify() public method

public InstVerify ( Type t1 ) : bool
t1 System.Type
return bool
	public bool InstVerify(System.Type t1)
	{
		bool result = true;

		if (!(Fld1.GetType().Equals(t1)))
		{	
			result = false;
			Console.WriteLine("Failed to verify type of Fld1 in: " + typeof(Outer<T>.IGen<T>) );
		}
		
		return result;
	}
}

Usage Example

Beispiel #1
0
    public static int Main()
    {
        IGen <int> IGenInt = new Gen <int>(new int());

        Eval(IGenInt.InstVerify(typeof(int)));

        IGen <double> IGenDouble = new Gen <double>(new double());

        Eval(IGenDouble.InstVerify(typeof(double)));

        IGen <string> IGenString = new Gen <string>("string");

        Eval(IGenString.InstVerify(typeof(string)));

        IGen <object> IGenObject = new Gen <object>(new object());

        Eval(IGenObject.InstVerify(typeof(object)));

        IGen <Guid> IGenGuid = new Gen <Guid>(new Guid());

        Eval(IGenGuid.InstVerify(typeof(Guid)));

        IGen <RefX1 <int> > IGenConstructedReference = new Gen <RefX1 <int> >(new RefX1 <int>());

        Eval(IGenConstructedReference.InstVerify(typeof(RefX1 <int>)));

        IGen <ValX1 <string> > IGenConstructedValue = new Gen <ValX1 <string> >(new ValX1 <string>());

        Eval(IGenConstructedValue.InstVerify(typeof(ValX1 <string>)));

        IGen <int[]> IGen1DIntArray = new Gen <int[]>(new int[1]);

        Eval(IGen1DIntArray.InstVerify(typeof(int[])));

        IGen <string[, ]> IGen2DStringArray = new Gen <string[, ]>(new string[1, 1]);

        Eval(IGen2DStringArray.InstVerify(typeof(string[, ])));

        IGen <object[][]> IGenJaggedObjectArray = new Gen <object[][]>(new object[1][]);

        Eval(IGenJaggedObjectArray.InstVerify(typeof(object[][])));

        if (result)
        {
            Console.WriteLine("Test Passed");
            return(100);
        }
        else
        {
            Console.WriteLine("Test Failed");
            return(1);
        }
    }