Version.MajorRevision Version.MajorRevision Version.MajorRevision Version.MajorRevision Property

定義

リビジョン番号の上位 16 ビットを取得します。Gets the high 16 bits of the revision number.

public:
 property short MajorRevision { short get(); };
public short MajorRevision { get; }
member this.MajorRevision : int16
Public ReadOnly Property MajorRevision As Short

プロパティ値

16 ビット符号付き整数。A 16-bit signed integer.

次のコード例は、Version のコンストラクターと、MajorMinorBuildRevisionMajorRevision、および MinorRevision の各プロパティを示しています。The following code example demonstrates the Version constructor, and the Major, Minor, Build, Revision, MajorRevision, and MinorRevision properties.

// This example demonstrates the Version.Revision,
// MajorRevision, and MinorRevision properties.
using namespace System;

int main()
{
    String^ formatStandard = "Standard version:\n" +
        " major.minor.build.revision = {0}.{1}.{2}.{3}";
    String^ formatInterim = "Interim version:\n" +
        " major.minor.build.majRev/minRev = {0}.{1}.{2}.{3}/{4}";

    Version^ standardVersion = gcnew Version(2, 4, 1128, 2);
    Version^ interimVersion = gcnew Version(2, 4, 1128, (100 << 16) + 2);

    Console::WriteLine(formatStandard, standardVersion->Major, 
        standardVersion->Minor, standardVersion->Build, 
        standardVersion->Revision);
    Console::WriteLine(formatInterim, interimVersion->Major,
        interimVersion->Minor, interimVersion->Build, 
        interimVersion->MajorRevision, interimVersion->MinorRevision);
};
/*
This code example produces the following results:

Standard version:
major.minor.build.revision = 2.4.1128.2
Interim version:
major.minor.build.majRev/minRev = 2.4.1128.100/2

*/
// This example demonstrates the Version.Revision,
// MajorRevision, and MinorRevision properties.
using System;

class Sample 
{
    public static void Main() 
    {

    string fmtStd = "Standard version:\n" +
                    "  major.minor.build.revision = {0}.{1}.{2}.{3}";
    string fmtInt = "Interim version:\n" +
                    "  major.minor.build.majRev/minRev = {0}.{1}.{2}.{3}/{4}";

    Version std = new Version(2, 4, 1128, 2);
    Version interim = new Version(2, 4, 1128, (100 << 16) + 2);

    Console.WriteLine(fmtStd, std.Major, std.Minor, std.Build, std.Revision);
    Console.WriteLine(fmtInt, interim.Major, interim.Minor, interim.Build, 
                              interim.MajorRevision, interim.MinorRevision);
    }
}
/*
This code example produces the following results:

Standard version:
  major.minor.build.revision = 2.4.1128.2
Interim version:
  major.minor.build.majRev/minRev = 2.4.1128.100/2

*/
' This example demonstrates the Version.Revision,
' MajorRevision, and MinorRevision properties.

Class Sample
    Public Shared Sub Main() 
        Dim fmtStd As String = "Standard version:" & vbCrLf & _
                               "  major.minor.build.revision = {0}.{1}.{2}.{3}"
        Dim fmtInt As String = "Interim version:" & vbCrLf & _
                               "  major.minor.build.majRev/minRev = {0}.{1}.{2}.{3}/{4}"
        
        Dim std As New Version(2, 4, 1128, 2)
        Dim interim As New Version(2, 4, 1128, (100 << 16) + 2)
        
        Console.WriteLine(fmtStd, std.Major, std.Minor, std.Build, std.Revision)
        Console.WriteLine(fmtInt, interim.Major, interim.Minor, interim.Build, _
                          interim.MajorRevision, interim.MinorRevision)
    End Sub
End Class

'
'This code example produces the following results:
'
'Standard version:
'  major.minor.build.revision = 2.4.1128.2
'Interim version:
'  major.minor.build.majRev/minRev = 2.4.1128.100/2
'

注釈

永続的なソリューションをリリースするまで一時的に問題を解決するには、アプリケーションの中間バージョンをリリースするとします。Suppose you release an interim version of your application to temporarily correct a problem until you can release a permanent solution. 一時的なバージョンでは、新しいリビジョン番号は保証されませんが、別のバージョンとして識別される必要があります。The temporary version does not warrant a new revision number, but it does need to be identified as a different version. この場合は、32ビットのリビジョン番号の上位および下位の16ビット部分で識別情報をエンコードします。In this case, encode the identification information in the high and low 16-bit portions of the 32-bit revision number. Revision プロパティを使用して、リビジョン番号全体を取得し、MajorRevision プロパティを使用して上位16ビットを取得し、MinorRevision プロパティを使用して下位16ビットを取得します。Use the Revision property to obtain the entire revision number, use the MajorRevision property to obtain the high 16 bits, and use the MinorRevision property to obtain the low 16 bits.

.NET Framework バージョン2.0 以降では、Windows NT オペレーティングシステムは MajorRevision プロパティを使用して Service Pack 番号をエンコードします。Starting in the .NET Framework version 2.0, the Windows NT operating system uses the MajorRevision property to encode the service pack number.

適用対象

こちらもご覧ください