public void TestStatic()
 {
     Assert.Equal(5, StaticExample.SumAuto(2, 3));
     Assert.Equal(6, StaticExample.SumMany(1, 1, 1, 1, 1, 1));
     Assert.Equal(5, StaticExample.SumManyIgnore(1, 1, 1, 1, 2, 3));
     Assert.Equal(30, StaticExample.SumWithLambda(10, 20));
     Assert.Equal("Hi", StaticExample.Bla);
 }
예제 #2
0
        private static void ThirdWeekExamples()
        {
            Console.WriteLine("Instance of AccessModifiers() called myAccMod1");
            AccessModifiers myAccMod1 = new AccessModifiers();

            Console.WriteLine("Instance of AccessModifiers() called myAccMod2");
            AccessModifiers myAccMod2 = new AccessModifiers("This one Has a String");

            Console.WriteLine("Indexer Example");
            myAccMod1.IndexerExample();
            Console.WriteLine("ClassFinalizerSample Class Definitions");
            ClassFinalizerSample myCFS  = new ClassFinalizerSample();
            ClassFinalizerSample myCFS2 = new ClassFinalizerSample("Johnny Quest", 4538702);
            ClassFinalizerSample myCFS3 = new ClassFinalizerSample("Johnny Quest");

            Console.WriteLine("Class Grades Assignment");
            ClassGrades myClassGrades = new ClassGrades("Joe ", "Smith", 'E');

            (string firstName, string lastName, char Grades) = myClassGrades;
            Console.WriteLine($"Person Details: First Name: {firstName}, Last Name: {lastName}, Grade: {Grades}");
            Console.WriteLine("Example of using NameOf");
            Console.WriteLine(myClassGrades.MyGradeType());
            DevelopmentClass myDevelopment = new DevelopmentClass();
            int x, y;

            x = myDevelopment.ClassTotal;
            y = myDevelopment.RoomTotal;
            Console.WriteLine($"Class Total: {x}, RoomTotal: {y}");
            Hatchback myHatchback1 = new Hatchback();

            myHatchback1.Color();
            myHatchback1.Size();
            myHatchback1.Speed();
            myHatchback1.Weight();

            Console.WriteLine(StaticExample.AddTwoNumbers(1, 2));
            Console.WriteLine(Math.Abs(-10));

            String Name = "Bob";

            if (IsPalinDrome.IsPalindrome(Name))
            {
                Console.WriteLine($"{Name} is a palindrome");
            }
            else
            {
                Console.WriteLine($"{Name} is not a palindrome");
            }

            if (IsPalinDrome.IsPalindrome(Name = "Sarah"))
            {
                Console.WriteLine($"{Name} is a palindrome");
            }
            else
            {
                Console.WriteLine($"{Name} is not a palindrome");
            }
        }
예제 #3
0
    static int Main(string[] args)
    {
        StaticExample s = new StaticExample();

        s.count();
        s.count();
        s.count();
        Console.WriteLine("The value of variable 		is {0}", StaticExample.display());
        return(0);
    }
        public void ConvertStaticMethodCall()
        {
            var sql = ExpressionToSql.Convert <ChildObject>(x => StaticExample.Method());

            sql.ShouldEqual("'someValue'");
        }
예제 #5
0
 public void StaticMethodExample()
 {
     var applicationName    = StaticExample.GetApplicationName();
     var applicationVersion = StaticExample.ApplicationVersion;
 }