OperatingSystem.ToString メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > OperatingSystem.ToString メソッドの意味・解説 

OperatingSystem.ToString メソッド

この OperatingSystem オブジェクトの値を等価文字列形式変換します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

使用例使用例

ToString メソッド使用してOperatingSystem オブジェクト表示するコード例次に示します

' Example for the OperatingSystem constructor and the  
' OperatingSystem.ToString( ) method.
Imports System
Imports Microsoft.VisualBasic

Module OpSysConstructDemo
    
    ' Create and display an OperatingSystem object.
    Sub BuildOSObj( pID As PlatformID, ver
 As Version )

        Dim os As New OperatingSystem(
 pID, ver )

        Console.WriteLine( "   {0}", os.ToString(
 ) )
    End Sub 
        
    Sub BuildOperatingSystemObjects( )

        ' The Version object does not need to correspond to an 
        ' actual OS version.
        Dim verNull     As New
 Version( )
        Dim verMajMin   As New
 Version( 3, 11 )
        Dim verMMBld    As New
 Version( 5, 25, 625 )
        Dim verMMBVer   As New
 Version( 5, 6, 7, 8 )
        Dim verString   As New
 Version( "3.5.8.13" )
            
        ' All PlatformID members are shown here.
        BuildOSObj( PlatformID.Win32NT, verNull )
        BuildOSObj( PlatformID.Win32S, verMajMin )
        BuildOSObj( PlatformID.Win32Windows, verMMBld )
        BuildOSObj( PlatformID.WinCE, verMMBVer )
        BuildOSObj( PlatformID.Win32NT, verString )
    End Sub 
        
    Sub Main( )
        Console.WriteLine( _
            "This example of the OperatingSystem constructor "
 & _
            "and " & vbCrLf & "OperatingSystem.ToString(
 ) " & _
            "generates the following output." &
 vbCrLf )
        Console.WriteLine( _
            "Create and display several different "
 & _
            "OperatingSystem objects:" & vbCrLf
 )

        BuildOperatingSystemObjects( )
            
        Console.WriteLine(vbCrLf & _
            "The OS version of the host computer is: "
 & _
            vbCrLf & vbCrLf & "   {0}", _
            Environment.OSVersion.ToString( ) )
    End Sub
End Module 

' This example of the OperatingSystem constructor and
' OperatingSystem.ToString( ) generates the following output.
' 
' Create and display several different OperatingSystem objects:
' 
'    Microsoft Windows NT 0.0
'    Microsoft Win32S 3.11
'    Microsoft Windows 98 5.25.625
'    Microsoft Windows CE 5.6.7.8
'    Microsoft Windows NT 3.5.8.13
' 
' The OS version of the host computer is:
' 
'    Microsoft Windows NT 5.1.2600.0
// Example for the OperatingSystem constructor and the 
// OperatingSystem.ToString( ) method.
using System;

class OpSysConstructDemo 
{
    // Create and display an OperatingSystem object.
    static void BuildOSObj( PlatformID pID,
 Version ver )
    {
        OperatingSystem os = new OperatingSystem( pID, ver );

        Console.WriteLine( "   {0}", os.ToString( ) );
    }

    static void BuildOperatingSystemObjects(
 )
    {
        // The Version object does not need to correspond to an 
        // actual OS version.
        Version verNull     = new Version( );
        Version verMajMin   = new Version( 3, 11 );
        Version verMMBld    = new Version( 5, 25, 625 );
        Version verMMBVer   = new Version( 5, 6, 7, 8 );
        Version verString   = new Version( "3.5.8.13"
 );

        // All PlatformID members are shown here.
        BuildOSObj( PlatformID.Win32NT, verNull );
        BuildOSObj( PlatformID.Win32S, verMajMin );
        BuildOSObj( PlatformID.Win32Windows, verMMBld );
        BuildOSObj( PlatformID.WinCE, verMMBVer );
        BuildOSObj( PlatformID.Win32NT, verString );
    }

    public static void Main(
 ) 
    {
        Console.WriteLine( 
            "This example of the OperatingSystem constructor " +
            "and \nOperatingSystem.ToString( ) " +
            "generates the following output.\n" );
        Console.WriteLine( 
            "Create and display several different " +
            "OperatingSystem objects:\n" );

        BuildOperatingSystemObjects( );

        Console.WriteLine( 
            "\nThe OS version of the host computer is:\n\n   {0}", 
            Environment.OSVersion.ToString( ) );
    }
}

/*
This example of the OperatingSystem constructor and
OperatingSystem.ToString( ) generates the following output.

Create and display several different OperatingSystem objects:

   Microsoft Windows NT 0.0
   Microsoft Win32S 3.11
   Microsoft Windows 98 5.25.625
   Microsoft Windows CE 5.6.7.8
   Microsoft Windows NT 3.5.8.13

The OS version of the host computer is:

   Microsoft Windows NT 5.1.2600.0
*/
// Example for the OperatingSystem constructor and the 
// OperatingSystem::ToString( ) method.
using namespace System;

// Create and display an OperatingSystem object.
void BuildOSObj( PlatformID pID, Version^ ver )
{
   OperatingSystem^ os = gcnew OperatingSystem( pID,ver );
   Console::WriteLine( "   {0}", os->ToString() );
}

void BuildOperatingSystemObjects()
{
   
   // The Version object does not need to correspond to an 
   // actual OS version.
   Version^ verNull = gcnew Version;
   Version^ verMajMin = gcnew Version( 3,11 );
   Version^ verMMBld = gcnew Version( 5,25,625 );
   Version^ verMMBVer = gcnew Version( 5,6,7,8 );
   Version^ verString = gcnew Version( "3.5.8.13" );
   
   // All PlatformID members are shown here.
   BuildOSObj( PlatformID::Win32NT, verNull );
   BuildOSObj( PlatformID::Win32S, verMajMin );
   BuildOSObj( PlatformID::Win32Windows, verMMBld );
   BuildOSObj( PlatformID::WinCE, verMMBVer );
   BuildOSObj( PlatformID::Win32NT, verString );
}

int main()
{
   Console::WriteLine( "This example of the OperatingSystem constructor and
 \n"
   "OperatingSystem::ToString( ) generates the following "
   "output.\n" );
   Console::WriteLine( "Create and display several different "
   "OperatingSystem objects:\n" );
   BuildOperatingSystemObjects();
   Console::WriteLine( "\nThe OS version of the host computer is:\n\n   {0}",
 Environment::OSVersion->ToString() );
}

/*
This example of the OperatingSystem constructor and
OperatingSystem::ToString( ) generates the following output.

Create and display several different OperatingSystem objects:

   Microsoft Windows NT 0.0
   Microsoft Win32S 3.11
   Microsoft Windows 98 5.25.625
   Microsoft Windows CE 5.6.7.8
   Microsoft Windows NT 3.5.8.13

The OS version of the host computer is:

   Microsoft Windows NT 5.1.2600.0
*/
// Example for the OperatingSystem constructor and the 
// OperatingSystem.ToString( ) method.
import System.*;

class OpSysConstructDemo
{
    // Create and display an OperatingSystem object.
    static void BuildOSObj(PlatformID pID,
 Version ver)
    {
        OperatingSystem os = new OperatingSystem(pID, ver);
        Console.WriteLine("   {0}", os.ToString());
    } //BuildOSObj

    static void BuildOperatingSystemObjects()
    {
        // The Version object does not need to correspond to an 
        // actual OS version.
        Version verNull = new Version();
        Version verMajMin = new Version(3, 11);
        Version verMMBld = new Version(5, 25, 625);
        Version verMMBVer = new Version(5, 6, 7, 8);
        Version verString = new Version("3.5.8.13");

        // All PlatformID members are shown here.
        BuildOSObj(PlatformID.Win32NT, verNull);
        BuildOSObj(PlatformID.Win32S, verMajMin);
        BuildOSObj(PlatformID.Win32Windows, verMMBld);
        BuildOSObj(PlatformID.WinCE, verMMBVer);
        BuildOSObj(PlatformID.Win32NT, verString);
    } //BuildOperatingSystemObjects

    public static void main(String[]
 args)
    {
        Console.WriteLine(("This example of the OperatingSystem constructor
 " 
            + "and \nOperatingSystem.ToString( ) " 
            + "generates the following output.\n"));
        Console.WriteLine(("Create and display several different " 
            + "OperatingSystem objects:\n"));
        BuildOperatingSystemObjects();
        Console.WriteLine(
            "\nThe OS version of the host computer is:\n\n   {0}",
            Environment.get_OSVersion().ToString());
    } //main
} //OpSysConstructDemo

/*
This example of the OperatingSystem constructor and
OperatingSystem.ToString( ) generates the following output.

Create and display several different OperatingSystem objects:

   Microsoft Windows NT 0.0
   Microsoft Win32S 3.11
   Microsoft Windows 98 5.25.625
   Microsoft Windows CE 5.6.7.8
   Microsoft Windows NT 3.5.8.13

The OS version of the host computer is:

   Microsoft Windows NT 5.1.2600.0
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「OperatingSystem.ToString メソッド」の関連用語

OperatingSystem.ToString メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



OperatingSystem.ToString メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS