Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

unexpected behavior of Object

$
0
0
 static void Main(string[] args)
        {

            object a = new  object();
            object cst=a;
            a = 6;
            Console.WriteLine(a + " " + cst);
                a="klm";
            Console.WriteLine(a+" "+cst);
}

output:

6  System.Object

klm System.Object

I expected the result as:

6  6 

klm  klm

Any explanation?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>