Environment.MachineName Propiedad
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene el nombre NetBIOS del equipo local.
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
Nombre de este equipo.
No se puede obtener el nombre de este equipo.
En el ejemplo siguiente se muestra el nombre del equipo que ejecuta el ejemplo de código. (El nombre de la máquina se omite en la salida de ejemplo por motivos de seguridad).
// 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---!
'
El nombre de este equipo se establece al iniciar el sistema cuando se lee el nombre del registro. Si este equipo es un nodo de un clúster, se devuelve el nombre del nodo.
Producto | Versiones |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
.NET Standard | 1.5, 1.6, 2.0, 2.1 |