我需要在我的C#应用程序中跟踪一个任意版本号,它的形式为M+.m+.b+
,其中M
代表“Major”(主要),m
代表“minor”(次要),b
代表“build”(构建),+
表示版本号不限于每个数字一个。
是否有内置的类可以基本上只保存3或4(第4个将是修订号)个int
并提供一些方便的比较功能,或者我需要编写自己的类?我想它会看起来像这样:
class VersionNumber
{
public int Major;
public int Minor;
public int Build;
public int Revision;
static public VersionNumber operator >(VersionNumber number)
{
// Comparison function here.
}
// Other comparison functions and whatnot here.
}
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
,它返回一个版本对象。 - undefined