Environment.MachineName Özellik

Tanım

Bu yerel bilgisayarın NetBIOS adını alır.

public:
 static property System::String ^ MachineName { System::String ^ get(); };
public static string MachineName { get; }
member this.MachineName : string
Public Shared ReadOnly Property MachineName As String

Özellik Değeri

String

Bu bilgisayarın adı.

Özel durumlar

Bu bilgisayarın adı alınamıyor.

Örnekler

Aşağıdaki örnek, kod örneğini çalıştıran bilgisayarın adını görüntüler. (Makine adı, güvenlik nedeniyle örnek çıktıdan atlanır.)

// Sample for the Environment::MachineName property
using namespace System;
int main()
{
   Console::WriteLine();
   
   //  <-- Keep this information secure! -->
   Console::WriteLine( "MachineName: {0}", Environment::MachineName );
}

/*
This example produces the following results:
(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".)

MachineName: !---OMITTED---!
*/
// Sample for the Environment.MachineName property
using System;

class Sample
{
    public static void Main()
    {
    Console.WriteLine();
//  <-- Keep this information secure! -->
    Console.WriteLine("MachineName: {0}", Environment.MachineName);
    }
}
/*
This example produces the following results:
(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked "!---OMITTED---!".)

MachineName: !---OMITTED---!
*/
// Sample for the Environment.MachineName property
open System

//  <-- Keep this information secure! -->
printfn $"\nMachineName: {Environment.MachineName}"

// This example produces the following results:
//     (Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked "!---OMITTED---!".)
//
//     MachineName: !---OMITTED---!
' Sample for the Environment.MachineName property
Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      '  <-- Keep this information secure! -->
      Console.WriteLine("MachineName: {0}", Environment.MachineName)
   End Sub
End Class
'
'This example produces the following results:
'(Any result that is lengthy, specific to the machine on which this sample was tested, 
'or reveals information that should remain secure, has been omitted 
'and marked "!---OMITTED---!".)
'
'MachineName: !---OMITTED---!
'

Açıklamalar

Bu bilgisayarın adı kayıt defterinden okunduğunda sistem başlangıcında oluşturulur. Bu bilgisayar bir kümedeki bir düğümse, düğümün adı döndürülür.

Şunlara uygulanır