本文整理汇总了C#中IValue类的典型用法代码示例。如果您正苦于以下问题:C# IValue类的具体用法?C# IValue怎么用?C# IValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IValue类属于命名空间,在下文中一共展示了IValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArrayAdapter
public ArrayAdapter(IValue array)
{
_array = array;
_list = array.ActualType.CreateGenericListInstance().As<IList>();
_listType = _list.GetType().ToCachedType();
_listType.InvokeAction("AddRange", _list, array.Instance);
}
示例2: ForceEarlyReturn
public void ForceEarlyReturn(IValue returnValue)
{
Contract.Requires<ArgumentNullException>(returnValue != null, "returnValue");
Contract.Requires<VirtualMachineMismatchException>(this.GetVirtualMachine().Equals(returnValue.GetVirtualMachine()));
throw new NotImplementedException();
}
示例3: AddCustomValue
private void AddCustomValue(XmlElement parent, PropertyAuditingData propertyAuditingData,
IValue value, ISimpleMapperBuilder mapper, bool insertable, bool key)
{
if (parent != null) {
XmlElement prop_mapping = MetadataTools.AddProperty(parent, propertyAuditingData.Name,
null, insertable, key);
//CustomType propertyType = (CustomType) value.getType();
XmlElement type_mapping = parent.OwnerDocument.CreateElement("type");
prop_mapping.AppendChild(type_mapping);
type_mapping.SetAttribute("name", value.GetType().Name);
if (value is SimpleValue) {
IDictionary<string, string> typeParameters = ((SimpleValue)value).TypeParameters;
if (typeParameters != null) {
foreach (KeyValuePair<string,string> paramKeyValue in typeParameters) {
XmlElement type_param = parent.OwnerDocument.CreateElement("param");
type_param.SetAttribute("name", (String) paramKeyValue.Key);
type_param["name"].Value = paramKeyValue.Value;
}
}
}
MetadataTools.AddColumns(prop_mapping, (IEnumerator<ISelectable>)value.ColumnIterator);
}
if (mapper != null) {
mapper.Add(propertyAuditingData.getPropertyData());
}
}
示例4: MapValue
public static IPersistentValue MapValue(IValue value)
{
var component = value as Component;
if(component != null)
{
return new PersistentComponent(MapProperties(component.PropertyIterator));
}
var collection = value as Collection;
if(collection != null)
{
return new PersistentCollection(MapValue(collection.Element));
}
var toOne = value as ToOne;
if(toOne != null)
{
return new PersistentToOne(toOne.ReferencedEntityName);
}
var oneToMany = value as OneToMany;
if(oneToMany != null)
{
return new PersistentOneToMany(oneToMany.ReferencedEntityName);
}
return null;
}
示例5: Create
public static IVariable Create(IValue val)
{
return new Variable()
{
_val = val
};
}
示例6: Send
public void Send(
IValue receiver,
ValueSymbol selector,
IList<IValue> args,
VM vm,
SourceInfo info
)
{
IValueFunc func = null;
foreach (ValueSymbol klass in KlassList)
{
if (vm.Env.LookupMethod(klass, selector, out func))
{
break;
}
}
if (func == null)
{
throw new RheaException(
string.Format(
"invalid selector for {0}: {1}",
receiver,
selector.Name.ToIdentifier()
),
info
);
}
List<IValue> newArgs = new List<IValue>();
newArgs.Add(receiver);
newArgs.AddRange(args);
func.Call(newArgs, vm, info);
}
示例7: CreateAssignment
public void CreateAssignment(IValueRegister targetRegister, IValue value)
{
JavaScriptRegister registerToUse = targetRegister as JavaScriptRegister;
JavaScriptValue valueToUse = value as JavaScriptValue;
AppendFormatLine("{0} = {1};", registerToUse.Expression, valueToUse.Expression);
}
示例8: AddComponent
//@SuppressWarnings({"unchecked"})
public void AddComponent(XmlElement parent, PropertyAuditingData propertyAuditingData,
IValue value, ICompositeMapperBuilder mapper, String entityName,
EntityXmlMappingData xmlMappingData, bool firstPass)
{
Component prop_component = (Component) value;
ICompositeMapperBuilder componentMapper = mapper.AddComponent(propertyAuditingData.getPropertyData(),
prop_component.ComponentClassName);
// The property auditing data must be for a component.
ComponentAuditingData componentAuditingData = (ComponentAuditingData) propertyAuditingData;
// Adding all properties of the component
IEnumerator<Property> properties = (IEnumerator<Property>) prop_component.PropertyIterator.GetEnumerator();
while (properties.MoveNext()) {
Property property = properties.Current;
PropertyAuditingData componentPropertyAuditingData =
componentAuditingData.getPropertyAuditingData(property.Name);
// Checking if that property is audited
if (componentPropertyAuditingData != null) {
mainGenerator.AddValue(parent, property.Value, componentMapper, entityName, xmlMappingData,
componentPropertyAuditingData, property.IsInsertable, firstPass);
}
}
}
示例9: AddComponent
public void AddComponent(XmlElement parent, PropertyAuditingData propertyAuditingData,
IValue value, ICompositeMapperBuilder mapper, string entityName,
EntityXmlMappingData xmlMappingData, bool firstPass, bool insertable)
{
var propComponent = (Component) value;
var componentMapper = mapper.AddComponent(propertyAuditingData.GetPropertyData(),
propComponent.ComponentClassName);
// The property auditing data must be for a component.
var componentAuditingData = (ComponentAuditingData) propertyAuditingData;
// Adding all properties of the component
foreach (var property in propComponent.PropertyIterator)
{
var componentPropertyAuditingData = componentAuditingData.GetPropertyAuditingData(property.Name);
// Checking if that property is audited
if (componentPropertyAuditingData != null)
{
mainGenerator.AddValue(parent, property.Value, componentMapper, entityName, xmlMappingData,
componentPropertyAuditingData, property.IsInsertable && insertable, firstPass);
}
}
}
示例10: AddBasic
public bool AddBasic(XmlElement parent, PropertyAuditingData propertyAuditingData,
IValue value, ISimpleMapperBuilder mapper, bool insertable, bool key)
{
var type = value.Type;
var custType = type as CustomType;
var compType = type as CompositeCustomType;
if (type is ImmutableType || type is MutableType)
{
AddSimpleValue(parent, propertyAuditingData, value, mapper, insertable, key);
}
else if (custType != null)
{
AddCustomValue(parent, propertyAuditingData, value, mapper, insertable, key, custType.UserType.GetType());
}
else if (compType != null)
{
AddCustomValue(parent, propertyAuditingData, value, mapper, insertable, key, compType.UserType.GetType());
}
else
{
return false;
}
return true;
}
示例11: MemberDefinition
public MemberDefinition(CachedMember member, string name, IValue value)
{
Name = name;
Value = value;
Member = member;
IsNodeType = value.SpecifiedType.Type.CanBeCastTo<INode>();
}
示例12: CreateAssignment
public void CreateAssignment(IValueRegister targetRegister, IValue value)
{
JavaScriptRegister registerToUse = targetRegister as JavaScriptRegister;
JavaScriptValue valueToUse = value as JavaScriptValue;
AppendFormatLine("{0} = {1};", registerToUse.Expression, valueToUse.Expression.Replace("\n", "\n" + new String('\t', IndentationLevel)));
}
示例13: Change
/// <summary>
/// Constructor
/// </summary>
/// <param name="variable"></param>
/// <param name="previousValue"></param>
/// <param name="newValue"></param>
public Change(IVariable variable, IValue previousValue, IValue newValue)
{
Variable = variable;
PreviousValue = previousValue;
NewValue = newValue;
Applied = false;
}
示例14: CreateDeserializable
public static ObjectNodeBase CreateDeserializable(string name, IValue @object, INode parent,
Context context, CachedMember member = null)
{
var type = @object.SpecifiedType;
var kind = GetTypeKind(type, context.Options);
if (kind == TypeKind.Simple)
{
if (parent == null) throw new TypeNotSupportedException("simple type",
@object.SpecifiedType, Mode.Deserialize, "complex types");
return new ValueNode(context, name, @object, member, parent);
}
Func<object> factory = () => ObjectFactory.CreateInstance(type,
context.Options.Deserialization.ObjectFactory, parent.MapOrDefault(x => x.Value));
if (member == null || parent == null) @object.Instance = factory();
else @object = ValueFactory.Create(@object, factory);
switch (kind)
{
case TypeKind.Dictionary: return new DictionaryNode(context, name, @object, member, parent);
case TypeKind.Enumerable: return new EnumerableNode(context, name, @object, member, parent);
default: return new ObjectNode(context, name, @object, member, parent);
}
}
示例15: MethodExitEventArgs
internal MethodExitEventArgs(VirtualMachine virtualMachine, SuspendPolicy suspendPolicy, EventRequest request, ThreadReference thread, Location location, IValue returnValue)
: base(virtualMachine, suspendPolicy, request, thread, location)
{
Contract.Requires<ArgumentNullException>(returnValue != null, "returnValue");
_returnValue = returnValue;
}