0% found this document useful (0 votes)
31 views3 pages

How To Get System Environment Information in WPF

How to get System Environment information in wpf. Demonstrates how to get operating system,.NET version, machine name, user name, domain name, system directory name, current directory name, command line.

Uploaded by

Abhi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

How To Get System Environment Information in WPF

How to get System Environment information in wpf. Demonstrates how to get operating system,.NET version, machine name, user name, domain name, system directory name, current directory name, command line.

Uploaded by

Abhi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

How to get System Environment information in WPF

This article demonstrates how to get system environment information like Operating System,.NET Version, Machine Name, Username, Domain Name, Directory Name, Command Line using wpf. Here we go, first of all create a new WPF Project.

Image1. By default wpf application has some assembly

Image2. Now let's start working on .xaml page. First of all add a namespace for mscorlib assembly. xmlns:r="clr-namespace:System;assembly=mscorlib" MSCorlib- It is special, any compiler needs it because it contains types that are required to

make the language syntax work. System.Array, System.Int32, System.String, System.Exception, etc. Write this .xamlcode on page: <TextBlock> <Label Content="Operating System Version : "></Label> <Label Content="{x:Static r:Environment.OSVersion}"></Label> <LineBreak></LineBreak> <Label Content="Dot NET Version : "></Label> <Label Content="{x:Static r:Environment.Version}"></Label> <LineBreak></LineBreak> <Label Content="Machine Name : "></Label> <Label Content="{x:Static r:Environment.MachineName}"></Label> <LineBreak></LineBreak> <Label Content="User Name : "></Label> <Label Content="{x:Static r:Environment.UserName}"></Label> <LineBreak></LineBreak> <Label Content="User Domain Name : "></Label> <Label Content="{x:Static r:Environment.UserDomainName}"></Label> <LineBreak></LineBreak> <Label Content="System Directory : "></Label> <Label Content="{x:Static r:Environment.SystemDirectory}"></Label> <LineBreak></LineBreak> <Label Content="Current Directory : "></Label> <Label Content="{x:Static r:Environment.CurrentDirectory}"></Label> <LineBreak></LineBreak> <Label Content="Command Line : "></Label> <Label Content="{x:Static r:Environment.CommandLine}"></Label> </TextBlock> Run application:

Image3.

Here you can see operating system version, dot net version, machine name, user name, domain name, system directory name, current directory name, command line. Hope this will help you to get system environment information. If you have any question and doubts then drop me a line in c-sharpcorner comment section.
Comment Request!

Thank you for reading this post. Please post your feedback, question, or comments about this post Here.

You might also like