Object Methods With Primary Data Type C# with Example



Object Methods With Primary Data Type C# with Example

 using System;

namespace CSharpFundamentals
{
    class ObjectMethodsWithPrimaryDataType
    {
        private static void Main(string[] args)
        {
            Console.WriteLine("Using Methods of System.Object Top Level Class with Primary Data");
            /* A C# int is really a shorthand for System.Int32 which inherits the following members 
from System.Object. */
            Console.WriteLine("100.GetHashCode() = {0}", 100.GetHashCode());
            Console.WriteLine("100.Equals(23) = {0}", 100.Equals(200));
            Console.WriteLine("100.ToString() = {0}", 100.ToString());

            Console.WriteLine();

            Console.WriteLine("100.GetType() = {0}", 100.GetType());
            Console.WriteLine("true.GetType() = {0}", true.GetType());
            Console.WriteLine("100.10.GetType() = {0}", 100.10D.GetType());
            Console.WriteLine("\"100\".GetType() = {0}", "100".GetType());
        }
    }
}
 

0 Comment's

Comment Form

Submit Comment