![]() ![]() These variables can point to “nothing”, though, and that’s what we call a null reference: a reference that doesn’t point to any object. So, a reference is what a variable of a reference type contains. Types such as int (and the other numerical primitive types), DateTime, and boolean are value types. If it helps you visualize it better, you can think of a reference as a linking pointing to a web page, or a shortcut pointing to a file on your computer. They hold a reference that points to where the object lives in memory. Reference types variables, on the other hand, don’t hold the value itself. If you have a variable of a value type, it stores the value itself. NET, you can divide data types in two categories: value types and reference types. But what is a null reference? In what way does it differ from a non-null reference? We already know that the NullReferenceException is caused by a null reference. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |