Articles → .NET → Is struct a value type or reference type

Is struct a value type or reference type











public struct Book
{

}




Book a = new Book();
Book b = a;
if (Object.ReferenceEquals(a, b))
{
                Console.WriteLine("Both objects are pointing to same location");
}
else
{
                Console.WriteLine("Both objects are pointing to different location");
}







Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Friday, April 24, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250