Environment.MachineName プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)




コード例を実行しているコンピュータの名前を表示するコード例を次に示します。(コード例の出力結果は、セキュリティ上の理由により、コンピュータ名を省略して記載しています。)
' Sample for the Environment.MachineName property Imports System Class Sample Public Shared Sub Main() Console.WriteLine() ' <-- Keep this information secure! --> Console.WriteLine("MachineName: {0}", Environment.MachineName) End Sub 'Main End Class 'Sample ' '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 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 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 import System.*; class Sample { public static void main(String[] args) { Console.WriteLine(); // <-- Keep this information secure! --> Console.WriteLine("MachineName: {0}", Environment.get_MachineName()); } //main } //Sample /* 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---! */


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からEnvironment.MachineName プロパティを検索する場合は、下記のリンクをクリックしてください。

- Environment.MachineName プロパティのページへのリンク