المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Generics and Properties.Settings.Default ...



C# Programming
07-16-2009, 08:00 PM
Hi All,

I've been looking around for any pointers on how this might be 'dressed up' in some form of 'catch all' generic call to based on a string key value.

I guess this would involve reflection in order to get at the class properties. Has anyone come across something like this?

I would like to be able to use syntax like along the lines of:


public T GetSettingValue(string key)
{
return (T)Properties.Settings.Default.Properties[key].Value;
}


Cheers,

Jammer
My Blog (http://jammer.biz/blog2/) | Articles (http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=4664921)