Esempio n. 1
0
        public static void Serialize(IFoo h)
        {
		Point  point1 = new Point (0, 1);
                Point? point2 = new Point (1, 2);
		h.Foo (ref point1);
                h.Foo (ref point2);
        }
Esempio n. 2
0
    public static void Serialize(IFoo h)
    {
        Point point1 = new Point(0, 1);
        Point?point2 = new Point(1, 2);

        h.Foo(ref point1);
        h.Foo(ref point2);
    }
Esempio n. 3
0
        public static void Main()
        {
            new B();
            IFoo i = null;

            i.Foo();
        }
        public static void Main()
        {
            IBar b = new A();
            IFoo f = b;

            f.Foo();
        }
Esempio n. 5
0
        public sbyte FooBar()
        {
            byte  foo    = _foo.Foo();
            sbyte fooBar = Convert.ToSByte(-foo);

            return(fooBar);
        }
Esempio n. 6
0
        static void StandaloneHelperToMarkIFoo()
        {
            // Reference IFoo outside Main to prevent it from being
            // kept by the body stack logic
            IFoo i = HelperToMarkIFoo();

            i.Foo();
        }
Esempio n. 7
0
 static void WalkFooHierarchy(IFoo foo)
 {
     foo.Foo();
     Action<IFoo> specialChildAction;
     if (SpecialClassActions.TryGetValue(foo.GetType(), out specialAction))
     {
         specialChildAction(foo);
     }
 }
Esempio n. 8
0
    static int Main()
    {
        C        c = new C();
        IFoo <A> i = c;

        i.Foo(null);
        System.Console.WriteLine("PASSED");
        return(100);
    }
Esempio n. 9
0
    public static int Main()
    {
        FooBar <string, object> fooBar = new FooBar <string, object>();
        IFoo <string>           foo    = (IFoo <string>)fooBar;
        IBar <string[]>         bar    = (IBar <string[]>)fooBar;

        Console.WriteLine("Calling IFoo<string>.Foo on FooBar<string, object> - expecting default method IFoo<string>.Foo");
        Test.Assert(foo.Foo("ABC") == typeof(string), "Calling IFoo<string>.Foo on FooBar<string, object>");

        Console.WriteLine("Calling IBar<string[]>.Foo on FooBar<string, object> - expecting default method IBar<object>.Foo");
        Test.Assert(bar.Bar(new string[] { "ABC" }) == typeof(object), "Calling IBar<object>.Bar on FooBar<string, object>");

        return(Test.Ret());
    }
        public static int MainMethod(string[] args)
        {
            Derived d = new Derived();
            IFoo    x = d as IFoo;

            d.Foo(2);
            if (Test.Status != 1)
            {
                return(1);
            }
            x.Foo();
            if (Test.Status != 2)
            {
                return(1);
            }
            return(0);
        }
Esempio n. 11
0
    public static void Negative()
    {
        FooClass fooObj = new FooClass();
        IFoo     foo    = (IFoo)fooObj;

        Console.WriteLine("Calling IFoo.Foo on Foo - expecting exception.");
        try
        {
            foo.Foo(10);
            Test.Assert(false, "Expecting exception on Foo");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exception caught: " + ex.ToString());
        }

        I47Class i47Class = new I47Class();
        I1       i1       = (I1)i47Class;

        Console.WriteLine("Calling I1.Func on I47Class - expecting exception");
        try
        {
            i1.Func(10);
            Test.Assert(false, "Expecting exception on I47Class");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exception caught: " + ex.ToString());
        }

        var          gi23Class = new GI23Class <object>();
        GI1 <object> gi1       = (GI1 <object>)gi23Class;

        Console.WriteLine("Calling GI1<T>.Func on GI23Class<S> - expecting exception");
        try
        {
            Type[] types;
            gi1.Func <string>(out types);
            Test.Assert(false, "Expecting exception on GI23Class");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exception caught: " + ex.ToString());
        }
    }
Esempio n. 12
0
        public S16 Caller(int a)
        {
            // Add some computation so this is not inlineable (but don't mark it noinline,
            // which would prevent the tailcall consideration).
            int i = 7;

            try
            {
                for (int j = 0; j < a; j++)
                {
                    i += j;
                }
            }
            finally
            {
                i += 2;
            }

            return(m_if.Foo(m_bs, i, a));
        }
Esempio n. 13
0
    public static int Main()
    {
        FooBar fooBar = new FooBar();
        IFoo   foo    = (IFoo)fooBar;
        IBar   bar    = (IBar)fooBar;
        IBlah  blah   = (IBlah)fooBar;

        Console.WriteLine("Calling IFoo.Foo on FooBar - expecting default method on IFoo.Foo. ");
        Test.Assert(foo.Foo(10) == 11, "Calling IFoo.Foo on FooBar");

        Console.WriteLine("Calling IBar.Bar on FooBar - expecting default method on IBar.Bar. ");
        Test.Assert(bar.Bar(10) == 20, "Calling IBar.Bar on FooBar");

        Console.WriteLine("Calling IBlah.Blah on FooBar - expecting default method on IBlah.Blah from Base. ");
        Test.Assert(blah.Blah(10) == 16, "Calling IBlah.Blah on FooBar");

        Console.WriteLine("Calling FooBar.CallBlahProtected - expecting protected methods on interface can be called");
        Test.Assert(fooBar.CallBlahProtected() == 3, "Calling FooBar.CallBlahProtected");

        return(Test.Ret());
    }
Esempio n. 14
0
    static int Main(string[] args)
    {
        FooBar <object> fooBar = new FooBar <object>();
        IFoo            foo    = (IFoo)fooBar;
        IBar <object>   bar    = (IBar <object>)fooBar;

        Console.WriteLine("Calling IFoo.Foo<String> on FooBar<Object> - expecting IFoo::Foo<string>() returning typeof(string)");
        Test.Assert(foo.Foo <string>() == typeof(string), "Calling IFoo.Foo<String> on FooBar<Object>");

        Console.WriteLine("Calling IBar.Bar1<String> on FooBar<object> - expecting bar.Bar1<string>() returning typeof(string)");
        Test.Assert(bar.Bar1 <string>() == typeof(string), "Calling IBar.Bar1<String> on FooBar<object>");

        Console.WriteLine("Calling IBar.Bar2<String[]> on FooBar<object> - expecting bar.Bar2<string[]>() returning typeof(string[])");
        Test.Assert(bar.Bar2 <string[]>() == typeof(string[]), "Calling IBar.Bar2<String[]> on FooBar<object>");

        Type p, k;

        Console.WriteLine("Calling IBar.Bar3<String, String[]> - expecting bar.Bar3<string>() returning typeof(string), typeof(string[])");
        bar.Bar3 <string, string[]>(out p, out k);
        Test.Assert(p == typeof(string) && k == typeof(string[]), "Calling IBar.Bar3<String, String[]>");

        return(Test.Ret());
    }
Esempio n. 15
0
        static void Main(string[] args)
        {
            var foo = new IFoo();

            Console.WriteLine(foo.Foo());
        }
Esempio n. 16
0
 void Start()
 {
     foo.Foo();
 }
Esempio n. 17
0
 public void CallsInterface(IFoo foo)
 {
     foo.Foo();
 }
Esempio n. 18
0
        private static void UseServices()
        {
            IFoo foo = Container.GetService <IFoo>();

            foo.Foo();
        }
Esempio n. 19
0
 public void RunTest1()
 {
     Assert.That(foo.Foo(), Is.EqualTo(10));
 }
 void IBar.Bar()
 {
     Console.WriteLine($"Bar {_foo.Foo()}");
 }