Dictionary<string, Object> temp = new Dictionary<string,Object>();
foreach (KeyValuePair<string, object> kvp in temp)
{
kvp.Value; //值
kvp.Key; //键
}
public T GetVariableValue<T>(string patrVariableName)
{
object outValue;
if (temp.TryGetValue(patrVariableName, out outValue))
{
return (T)outValue;
}
else
{
return default(T);
}
}
Object mobj;
mobj=this.GetVariableValue<object>(patrVariableName)
Type mType=mobj.GetType();
objValue = Convert.ChangeType(value, mType);