Why is the .NET Version a class and not a structure?

According ReferenceSource , class Version sealed, ICloneable, IComparable, IComparable<Version>, IEquatable<Version>. It also saves only values int. Is there any special reason why .NET programmers decided to make this class instead of a structure? Why would anyone need a version null?

Here's the field declaration block from the ReferenceSource:

// AssemblyName depends on the order staying the same
private int _Major;
private int _Minor;
private int _Build = -1;
private int _Revision = -1;

They even make a comment saying they need to maintain field alignment. Maybe it's just me, but is it really a structural thing?

+4
source share
1 answer

Why would anyone need a version null?

, , , AssemblyName, . , AssemblyName Assembly.Load, Version null. , .NET 1.0, , Nullable<Version> .

+5

Source: https://habr.com/ru/post/1623580/


All Articles