Geeks With Blogs


Timmy Kokke's Blog

↑ Grab this Headline Animator

Timmy Kokke at Blogged
Timmy Kokke …just sorting my bubbles…


I’d like to provide you with a SilverBullet™, a small snippet of Silverlight, a class or namespace hidden in the silverlight .NET framework, to help you out in times of need. It’s not to learn, but something to keep in your pocket. Just remember it’s there and you’re safe.


This first SilverBulletI would like to give you is the Environment class. It’s in the System namespace and provides information about the environment your application is running in. Use it to get information about the system, like command-line arguments, version of the CLR and the time the system is running.  Some properties and methods in this class are used internally and can cause security risks. These properties and methods will throw an MethodAccessException. All properties are static.


The properties that can be used are:

  • Environment.ExitCode; a 32-bit  int containing the current exit code.
  • Environment.HasShutdownStarted; a bool indicating the CLR is shutting down or the appdomain is unloading.
  • Environment.NewLine; a string containing the local systems newline characters, this is different on unix and windows.
  • Environment.OSVersion; an OperatingSystem object containing a platform id and version.
  • Environment.TickCount; a long containing the amount of milliseconds since the system started.
  • Environment.Version; a Version object describing the version of the CLR.


If you have any suggestions for another SilverBullet™, please let me know.

Shout it kick it on
Tags van Technorati:

dotNed blogger

Posted on Tuesday, June 9, 2009 10:11 AM Silverlight , SilverBullet | Back to top

Comments on this post: SilverBullet #1 – System.Environment

# re: SilverBullet #1 – System.Environment
Requesting Gravatar...
The GetFolderPath method is marked [Security Critical]. Having a look at the system a Silverlight application is running on can cause serious security risks and is not allowed. Calling GetFolderPath will throw a MethodAccessException.
You can only use this in the "normal" version of the .NET framework when running desktop applications.
Left by Timmy Kokke on Jun 09, 2009 2:59 PM

# re: SilverBullet #1 – System.Environment
Requesting Gravatar...
Cool post.
Will try to use these features.

Left by Thanigainathan.S on Jul 24, 2009 12:50 AM

Your comment:
 (will show your gravatar)

Copyright © Timmy Kokke | Powered by: