Tuesday, August 17, 2010

Using PowerCfg to Evaluate System Energy Efficiency

Use PowerCfg to Evaluate Energy Efficiency of your laptop. Just type the following command powercfg –ENERGY via command prompt To have more knowledge about this command, just follow the above link. http://www.microsoft.com/whdc/system/pnppwr/powermgmt/powercfg.mspx

Friday, June 4, 2010

Convert string[] to ArrayList And ArrayList to string[]

This is how you can convert a string[] into an ArrayList in c#
  
  
// string[] -> ArrayList
string[] msg = this.message.Split('\n');

ArrayList arrayList = new ArrayList();
arrayList.AddRange(msg);
  
// ArrayList -> string[]
string[] arrayStrings = arrayList.ToArray(typeof(string)) as string[];

Thursday, May 27, 2010

Password Property in a PropertyGrid

If you have a property in a class to keep track of a password, and you want that class to be editable in a PropertyGrid, but you don't want the password to be human readable, then you just need to add the attribute PasswordPropertyTextAttribute to your property and set the in argument to true, like the example below. This way the users will see circles instead of the pressed keys.
  
[PasswordPropertyTextAttribute(true)]
public string Password { get; set; }