Home > DeveloperSection > Forums > how to get machine name in c#
lois waisbrooker
lois waisbrooker

Total Post:70

Points:494
Posted on    June-08-2013 8:00 AM

 C# C# 
Ratings:


 1 Reply(s)
 1123  View(s)
Rate this:
Hi Developers,

I want to get machine name (e.g. my PC name is "compter-1") using C# line of code.
Please provide line of code or any useful link!

Thanks in advance. 


Vijay Shukla

Total Post:100

Points:700
Posted on    June-08-2013 8:11 AM

Hi lois waisbrooker!
below line of code show your machine name (PC-name) .
class MachineName
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Environment.MachineName);
            Console.ReadKey();
        }
    }

Don't want to miss updates? Please click the below button!

Follow MindStick