加入自动类型转换
This commit is contained in:
@@ -11,7 +11,34 @@ namespace Convention.RScript
|
||||
public struct RScriptVariableEntry
|
||||
{
|
||||
public Type type;
|
||||
public object data;
|
||||
public object data
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return internalData;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
type = value.GetType();
|
||||
internalData = value;
|
||||
return;
|
||||
}
|
||||
internalData = Convert.ChangeType(value, type);
|
||||
}
|
||||
}
|
||||
private object internalData;
|
||||
|
||||
public RScriptVariableEntry(object data) : this()
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
public RScriptVariableEntry(Type type, object data) : this()
|
||||
{
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
public class RScriptVariables : IDictionary<string, RScriptVariableEntry>
|
||||
{
|
||||
|
Reference in New Issue
Block a user