One, packing and unpacking
Boxing is the conversion of a value type to a reference type. A unboxing is the conversion of a reference type to a value type.
For example, we are very commonly used. The ToString () method is typically a boxed process.
Again, as in the following example
int i=10;
Object Y= (object) I; This is boxing.
int x= (int) y; This is the unboxing.
Second, the Equality comparison of objects
In C #, there are four more equal methods.
1, ReferenceEquals () The method is a static method that determines whether two references point to the same instance. That is, whether it points to the same memory address, and if so, returns True, otherwise it returns false.
2, the virtual Equals () method. Because it is a virtual method, it can be overridden. This allows it to be used to compare objects or to compare values.
3, Static Equals () method, which is the same as the virtual Equals () method, but with two parameters, and compare it. This method can handle the case where one of the two objects is null, and when one is null, an exception is thrown.
4. Comparison operator = = We'd better consider this comparison as the intermediate option between strict value comparisons and strict reference comparisons. But note that this is the way to compare strings, not references.