How to get the computer name using C#?

Hi all,

Does anyone know how to get the computer name using c#

Thanks



Answer this question

How to get the computer name using C#?

  • Hurm

    Try using this

    Code Snippet
    SystemInformation
    .ComputerName



  • RussNem

    i cannot use the

    "System.Environment.MachineName " .

    some one told me to use=

    using System.Security.Principal;

    WindowsIdentity.GetCurrent().Name.ToString();

    but the last line isn't working.

    plz, i need this solution.



  • MaurizioG

    System.Environment.MachineName



  • How to get the computer name using C#?