コード例 #1
0
ファイル: L-1-7-3.cs プロジェクト: CheneyWu/coreclr
	public static int Test(){
		int mi_RetCode = 100;
		
		B.ClsB bc = new B.ClsB();
		A.ClsA ac = new A.ClsA();
		B b = new B();
		
		if(Test_Nested(bc) != 100)
			mi_RetCode = 0;
		
		if(Test_Nested(ac) != 100)
			mi_RetCode = 0;

		//@csharp - C# simply won't compile non-related private/family/protected access
		
		if(Test_Nested(b.ClsAPubInst) != 100)
			mi_RetCode = 0;
		
		if(Test_Nested(B.ClsAPubStat) != 100)
			mi_RetCode = 0;
				
		if(Test_Nested(b.ClsBPubInst) != 100)
			mi_RetCode = 0;
		
		if(Test_Nested(b.ClsBAsmInst) != 100)
			mi_RetCode = 0;
		
		if(Test_Nested(b.ClsBFoaInst) != 100)
			mi_RetCode = 0;

		if(Test_Nested(B.ClsBPubStat) != 100)
			mi_RetCode = 0;
				
		return mi_RetCode;
	}
コード例 #2
0
ファイル: L-1-7-3.cs プロジェクト: layomia/dotnet_runtime
    public static int Test()
    {
        int mi_RetCode = 100;

        B.ClsB bc = new B.ClsB();
        A.ClsA ac = new A.ClsA();
        B      b  = new B();

        if (Test_Nested(bc) != 100)
        {
            mi_RetCode = 0;
        }

        if (Test_Nested(ac) != 100)
        {
            mi_RetCode = 0;
        }

        //@csharp - C# simply won't compile non-related private/family/protected access

        if (Test_Nested(b.ClsAPubInst) != 100)
        {
            mi_RetCode = 0;
        }

        if (Test_Nested(B.ClsAPubStat) != 100)
        {
            mi_RetCode = 0;
        }

        if (Test_Nested(b.ClsBPubInst) != 100)
        {
            mi_RetCode = 0;
        }

        if (Test_Nested(b.ClsBAsmInst) != 100)
        {
            mi_RetCode = 0;
        }

        if (Test_Nested(b.ClsBFoaInst) != 100)
        {
            mi_RetCode = 0;
        }

        if (Test_Nested(B.ClsBPubStat) != 100)
        {
            mi_RetCode = 0;
        }

        return(mi_RetCode);
    }
コード例 #3
0
ファイル: L-1-7-3.cs プロジェクト: layomia/dotnet_runtime
    public static int Test_Nested(B.ClsB bc)
    {
        int mi_RetCode = 100;

        /////////////////////////////////
        // Test instance field access
        bc.NestFldBPubInst = 100;
        if (bc.NestFldBPubInst != 100)
        {
            mi_RetCode = 0;
        }

        bc.NestFldBAsmInst = 100;
        if (bc.NestFldBAsmInst != 100)
        {
            mi_RetCode = 0;
        }

        bc.NestFldBFoaInst = 100;
        if (bc.NestFldBFoaInst != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static field access
        B.ClsB.NestFldBPubStat = 100;
        if (B.ClsB.NestFldBPubStat != 100)
        {
            mi_RetCode = 0;
        }

        B.ClsB.NestFldBAsmStat = 100;
        if (B.ClsB.NestFldBAsmStat != 100)
        {
            mi_RetCode = 0;
        }

        B.ClsB.NestFldBFoaStat = 100;
        if (B.ClsB.NestFldBFoaStat != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test instance method access
        if (bc.NestMethBPubInst() != 100)
        {
            mi_RetCode = 0;
        }

        if (bc.NestMethBAsmInst() != 100)
        {
            mi_RetCode = 0;
        }

        if (bc.NestMethBFoaInst() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static method access
        if (B.ClsB.NestMethBPubStat() != 100)
        {
            mi_RetCode = 0;
        }

        if (B.ClsB.NestMethBAsmStat() != 100)
        {
            mi_RetCode = 0;
        }

        if (B.ClsB.NestMethBFoaStat() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test virtual method access
        if (bc.NestMethBPubVirt() != 100)
        {
            mi_RetCode = 0;
        }

        if (bc.NestMethBAsmVirt() != 100)
        {
            mi_RetCode = 0;
        }

        if (bc.NestMethBFoaVirt() != 100)
        {
            mi_RetCode = 0;
        }

        ////////////////////////////////////////////
        // Test access from within the nested class
        if (bc.Test() != 100)
        {
            mi_RetCode = 0;
        }

        return(mi_RetCode);
    }