You can know if your software runs as administrator or not by using a simple variable like this public bool IsElevated { get { return new WindowsPrincipal(WindowsIdentity.GetCurrent()) .IsInRole(WindowsBuiltInRole.Administrator); } } IsElevated will return true if the software runs as admin or false if not.
0 Comments
To get a software's version you need to use this code: string version = Assembly.GetExecutingAssembly().GetName().Version.ToString() "version" now has the version of your software in x.x.x.x way you can use .SubString to cut it as you want.
Hi All,
This blog is for posting tips and tricks about C# and Java (mainly C#). And i hope that this blog will be useful for many new programmers specially who learn programming by themselves. Everyday will be a new tip/trick. If someone is interesting in specific thing please comment and i will try my best to show help. |
SamiHi, I program in C# and also in Java. I hope that i will be useful for you with these basic tips and tricks in programming ArchivesCategories |