The base class of the type System.Object
Q: Is there a class that does not inherit from System.Object
By using the ILasm.exe noautoinherit switch, you can generate a type that is not inherited from System.Object, which is not a secure type and is not recommended for use. However, because of the existence of such a mechanism, programmers cannot arbitrarily treat any object by default as a System.Object subtype when writing code.
Q: What are the similarities and differences between the three comparison methods defined in System.Object
The static method ReferenceEquals implements a reference comparison. The static Equals method implements the ability to invoke an instance of the Equals method more efficiently. The instance equals method is a virtual method, the default implementation is a reference comparison, and the type can override the instance of the Equals method as needed. The base class of the value type ValueType overrides the Equals method to achieve a comparison of the content.
Q: How to override the GetHashCode method
The GetHashCode algorithm in object guarantees that the same object returns the same hashcode, while different objects return different hashcode, but the default GetHashCode algorithm is incorrect for objects that are equal to the value type, such as the type of the equal object.
Overriding GetHashCode must ensure that the same object returns the same hashcode at any time, and that equal objects must return the same value. and ensure that the hashcode random hash distribution as far as possible.
Operation of the time System.DateTime
Q: What is UTC time and how to convert to UTC time
UTC is Greenwich Mean Time (GMT), which is the time measured at 0 degrees longitude. The ToUniversalTime and Tolocal methods allow you to convert between local time and UTC time.
Managing the types of files and folders
Q: How to manipulate files and folders
. NET built-in types provide FileInfo and DirectoryInfo two types, respectively, to manipulate files and folders.
Q: How to implement the monitoring function of files and folders
. NET provides the FileSystemWatcher type for file system monitoring. You need to be careful about FileSystemWatcher cache overflow scenarios.
. NET in the timer
Q:. NET provides a few timer types
System.Windows.Forms.Timer, System.Threading.Timer, System.Timers.Timer. System.Windows.Forms.Timer is characterized by inaccurate timing and missed beats; System.Threading.Timer is recommended.
Add: System.Threading.Timer and System.Timers.Timer have the possibility of a method re-entry problem, System.Windows.Forms.Timer does not exist this problem. In fact, the System.Windows.Forms.Timer type does not involve multi-threaded operations, the setting of the timer, the execution of the timing method are all on the same thread (UI thread).
Excerpt-it Enterprise must read 200. NET face questions-05 common classes and Interfaces