Пример #1
0
    static void Main()
    {
        DaysTemp temp = new DaysTemp();

        temp.High = 83;
        temp.Low  = 23;

        Console.WriteLine("High is {0}", temp.High);
        Console.WriteLine($"Low: { temp.Low }");
    }
Пример #2
0
    static void Main()
    {
        DaysTemp temp = new DaysTemp();            // Create the object

        temp.High = 85;                            // Assign to the fields
        temp.Low  = 60;

        Console.WriteLine("High: {0}", temp.High); // Read from fields
        Console.WriteLine($"Low:  { temp.Low }");
    }
Пример #3
0
    static void Main()
    {
        DaysTemp t1 = new DaysTemp();
        DaysTemp t2 = new DaysTemp();

        t1.High = 76;   t1.Low = 57;
        t2.High = 75;   t2.Low = 53;

        Console.WriteLine("t1: {0}, {1}, {2}", t1.High, t1.Low, t1.Average());
        Console.WriteLine("t2: {0}, {1}, {2}", t2.High, t2.Low, t2.Average());
    }
Пример #4
0
    static void Main()
    {
        // DaysTempのインスタンスを2つ作成
        DaysTemp T1 = new DaysTemp();
        DaysTemp T2 = new DaysTemp();

        // それぞれのインスタンスのフィールドに書き込み
        T1.High = 76;   T1.Low = 57;
        T2.High = 75;   T2.Low = 53;

        // それぞれのインスタンスのフィールドから読み出し
        // それぞれのインスタンスのメソッドを呼び出し
        Console.WriteLine("T1: {0}, {1}, {2}", T1.High, T1.Low, T1.Avg());
        Console.WriteLine("T2: {0}, {1}, {2}", T2.High, T2.Low, T2.Avg());
    }
Пример #5
0
    static void Main()
    {
        // Create two instances of DaysTemp
        DaysTemp t1 = new DaysTemp();
        DaysTemp t2 = new DaysTemp();

        // Write to the fields of each instance
        t1.High = 76;
        t1.Low  = 57;
        t2.High = 75;
        t2.Low  = 53;

        // Read from the fields of each instance and call a method of
        // each instance
        Console.WriteLine("t1: {0}, {1}, {2}", t1.High, t1.Low, t1.Average());
        Console.WriteLine("t2: {0}, {1}, {2}", t2.High, t2.Low, t2.Average());
    }