, , . - , ( , ).
. , , .
, . , - . , .
float GetFloat(string attrName) { }
string GetString(string attrName) { }
" ", . , , . , , ( ). , - , (int vs. uint long).
float GetValue(string attrName, float defaultValue) { ... }
string GetValue(string attrName, string defaultValue) { ... }
, , , . , - , . ( , , ). , - , ... ( ) .
T GetValue<T>( string attrName )
{
if( typeof(T) != typeof(string) ||
typeof(T) != typeof(float) )
throw new NotSupportedException();
return default(T);
}
float f = GetValue<float>(attrName);
string s = GetValue<string>(attrName);
out . , , , .
void GetValue( string attrName, out float value )
void GetValue( string attrName, out string value )
float f;
GetValue( attrName, out f );
string s;
GetValue( attrName, out s );