GetSquare() public method

public GetSquare ( ) : int
return int
コード例 #1
0
        static void Main()
        {
            // Try calling some static functions.
            WriteLine($"Pi is {Math.GetPi()}");
            int x = Math.GetSquareOf(5);
            WriteLine($"Square of 5 is {x}");

            // Instantiate a Math object
            var math = new Math();   // instantiate a reference type

            // Call instance members
            math.Value = 30;
            WriteLine($"Value field of math variable contains {math.Value}");
            WriteLine($"Square of 30 is {math.GetSquare()}");

            ReadLine();
        }
コード例 #2
0
        static void Main()
        {
            // Try calling some static functions.
            WriteLine($"Pi is {Math.GetPi()}");
            int x = Math.GetSquareOf(5);

            WriteLine($"Square of 5 is {x}");

            // Instantiate a Math object
            var math = new Math();   // instantiate a reference type

            // Call instance members
            math.Value = 30;
            WriteLine($"Value field of math variable contains {math.Value}");
            WriteLine($"Square of 30 is {math.GetSquare()}");

            ReadLine();
        }