本文整理汇总了C#中IValue类的典型用法代码示例。如果您正苦于以下问题:C# IValue类的具体用法?C# IValue怎么用?C# IValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IValue类属于命名空间,在下文中一共展示了IValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:carl-berg,项目名称:Bender,代码行数:7,代码来源:ArrayAdapter.cs
示例2: ForceEarlyReturn
public void ForceEarlyReturn(IValue returnValue)
{
Contract.Requires<ArgumentNullException>(returnValue != null, "returnValue");
Contract.Requires<VirtualMachineMismatchException>(this.GetVirtualMachine().Equals(returnValue.GetVirtualMachine()));
throw new NotImplementedException();
}
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:7,代码来源:IThreadReferenceContracts.cs
示例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());
}
}
开发者ID:hazzik,项目名称:nhcontrib-all,代码行数:31,代码来源:BasicMetadataGenerator.cs
示例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;
}
开发者ID:mausch,项目名称:NHWorkbench,代码行数:25,代码来源:ConfigurationMapper.cs
示例5: Create
public static IVariable Create(IValue val)
{
return new Variable()
{
_val = val
};
}
开发者ID:Shemetov,项目名称:OneScript,代码行数:7,代码来源:Variables.cs
示例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);
}
开发者ID:takuto-h,项目名称:rhea,代码行数:32,代码来源:KlassHolder.cs
示例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);
}
开发者ID:shravanrn,项目名称:Cleps,代码行数:7,代码来源:JavaScriptMethod.cs
示例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);
}
}
}
开发者ID:hazzik,项目名称:nhcontrib-all,代码行数:28,代码来源:ComponentMetadataGenerator.cs
示例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);
}
}
}
开发者ID:umittal,项目名称:MunimJi,代码行数:25,代码来源:ComponentMetadataGenerator.cs
示例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;
}
开发者ID:umittal,项目名称:MunimJi,代码行数:25,代码来源:BasicMetadataGenerator.cs
示例11: MemberDefinition
public MemberDefinition(CachedMember member, string name, IValue value)
{
Name = name;
Value = value;
Member = member;
IsNodeType = value.SpecifiedType.Type.CanBeCastTo<INode>();
}
开发者ID:carl-berg,项目名称:Bender,代码行数:7,代码来源:MemberDefinition.cs
示例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)));
}
开发者ID:shravanrn,项目名称:Cleps,代码行数:7,代码来源:JavaScriptMethod.cs
示例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;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:13,代码来源:Change.cs
示例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);
}
}
开发者ID:raidenyn,项目名称:Bender,代码行数:26,代码来源:NodeFactory.cs
示例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;
}
开发者ID:fjnogueira,项目名称:JavaForVS,代码行数:7,代码来源:MethodExitEventArgs.cs
示例16: CallAsFunction
public override void CallAsFunction(int methodNumber, IValue[] arguments, out IValue retValue)
{
if (methodNumber == 0)
retValue = ValueFactory.Create(this.Count());
else
retValue = null;
}
开发者ID:Shemetov,项目名称:OneScript,代码行数:7,代码来源:CommandLineArguments.cs
示例17: AddOneToOneNotOwning
//@SuppressWarnings({"unchecked"})
public void AddOneToOneNotOwning(PropertyAuditingData propertyAuditingData, IValue value,
ICompositeMapperBuilder mapper, String entityName)
{
OneToOne propertyValue = (OneToOne)value;
String owningReferencePropertyName = propertyValue.ReferencedPropertyName; // mappedBy
EntityConfiguration configuration = mainGenerator.EntitiesConfigurations[entityName];
if (configuration == null) {
throw new MappingException("An audited relation to a non-audited entity " + entityName + "!");
}
IdMappingData ownedIdMapping = configuration.IdMappingData;
if (ownedIdMapping == null) {
throw new MappingException("An audited relation to a non-audited entity " + entityName + "!");
}
String lastPropertyPrefix = MappingTools.createToOneRelationPrefix(owningReferencePropertyName);
String referencedEntityName = propertyValue.ReferencedEntityName;
// Generating the id mapper for the relation
IIdMapper ownedIdMapper = ownedIdMapping.IdMapper.PrefixMappedProperties(lastPropertyPrefix);
// Storing information about this relation
mainGenerator.EntitiesConfigurations[entityName].AddToOneNotOwningRelation(
propertyAuditingData.Name, owningReferencePropertyName,
referencedEntityName, ownedIdMapper);
// Adding mapper for the id
PropertyData propertyData = propertyAuditingData.getPropertyData();
mapper.AddComposite(propertyData, new OneToOneNotOwningMapper(owningReferencePropertyName,
referencedEntityName, propertyData));
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:34,代码来源:ToOneRelationMetadataGenerator.cs
示例18: AddCustomValue
private static void AddCustomValue(XmlElement parent, PropertyAuditingData propertyAuditingData,
IValue value, ISimpleMapperBuilder mapper, bool insertable,
bool key, System.Type typeOfUserImplementation)
{
if (parent != null)
{
var prop_mapping = MetadataTools.AddProperty(parent, propertyAuditingData.Name,
null, insertable, key);
MetadataTools.AddColumns(prop_mapping, value.ColumnIterator.OfType<Column>());
var typeElement = parent.OwnerDocument.CreateElement("type");
typeElement.SetAttribute("name", typeOfUserImplementation.AssemblyQualifiedName);
var simpleValue = value as SimpleValue;
if (simpleValue != null)
{
var typeParameters = simpleValue.TypeParameters;
if (typeParameters != null)
{
foreach (var paramKeyValue in typeParameters)
{
var type_param = typeElement.OwnerDocument.CreateElement("param");
type_param.SetAttribute("name", paramKeyValue.Key);
type_param.InnerText = paramKeyValue.Value;
typeElement.AppendChild(type_param);
}
}
}
prop_mapping.AppendChild(typeElement);
}
if (mapper != null)
{
mapper.Add(propertyAuditingData.GetPropertyData());
}
}
开发者ID:umittal,项目名称:MunimJi,代码行数:35,代码来源:BasicMetadataGenerator.cs
示例19: ReadLine
public ReadLineResult ReadLine(out SectionType secType, out string line, out string key, out IValue value)
{
secType = SectionType.None;
line = string.Empty;
key = string.Empty;
value = null;
if (streamReader == null)
{
return ReadLineResult.Error;
}
line = streamReader.ReadLine();
if (line == null)
{
return ReadLineResult.Null;
}
if (line == string.Empty)
{
return ReadLineResult.OK;
}
string trimmedLine = line.Trim();
if (trimmedLine == string.Empty)
{
secType = SectionType.Spaces;
return ReadLineResult.OK;
}
// line = trimmedLine;
return this.ParseLine(trimmedLine, ref secType, out key, out value);
}
开发者ID:mrddos,项目名称:planisphere,代码行数:28,代码来源:ScadaReader.cs
示例20: doFunctionCall
private IValue doFunctionCall(ParserRuleContext context, string targetFunctionName, List<IValue> parameters, IValue target, ClepsType targetType, bool allowVoidReturn)
{
IValue dereferencedTarget = target == null? null : GetDereferencedRegisterOrNull(target);
BasicClepsType dereferencedType = target == null? targetType as BasicClepsType : dereferencedTarget.ExpressionType as BasicClepsType;
if (dereferencedType == null)
{
string errorMessage = String.Format("Could not dereference expression on type {0}", targetType.GetClepsTypeString());
Status.AddError(new CompilerError(FileName, context.Start.Line, context.Start.Column, errorMessage));
//just return something to avoid stalling
return CodeGenerator.CreateByte(0);
}
ClepsClass targetClepsClass = ClassManager.GetClass(dereferencedType.GetClepsTypeString());
List<ClepsVariable> functionOverloads;
bool isStatic;
if (targetClepsClass.StaticMemberMethods.ContainsKey(targetFunctionName))
{
isStatic = true;
functionOverloads = targetClepsClass.StaticMemberMethods[targetFunctionName];
}
else if (target != null && targetClepsClass.MemberMethods.ContainsKey(targetFunctionName))
{
isStatic = false;
functionOverloads = targetClepsClass.MemberMethods[targetFunctionName];
}
else
{
string errorMessage = String.Format("Class {0} does not contain a {1}static function called {2}.", targetClepsClass.FullyQualifiedName, target == null? "" : "member or ",targetFunctionName);
Status.AddError(new CompilerError(FileName, context.Start.Line, context.Start.Column, errorMessage));
//Just return something to avoid stalling compilation
return CodeGenerator.CreateByte(0);
}
int matchedPosition;
string fnMatchErrorMessage;
if (!FunctionOverloadManager.FindMatchingFunctionType(TypeManager, functionOverloads, parameters, out matchedPosition, out fnMatchErrorMessage))
{
Status.AddError(new CompilerError(FileName, context.Start.Line, context.Start.Column, fnMatchErrorMessage));
//Just return something to avoid stalling compilation
return CodeGenerator.CreateByte(0);
}
FunctionClepsType chosenFunctionType = functionOverloads[matchedPosition].VariableType as FunctionClepsType;
if (!allowVoidReturn && chosenFunctionType.ReturnType == VoidClepsType.GetVoidType())
{
string errorMessage = String.Format("Function {0} does not return a value", targetFunctionName);
Status.AddError(new CompilerError(FileName, context.Start.Line, context.Start.Column, errorMessage));
//Just return something to avoid stalling compilation
return CodeGenerator.CreateByte(0);
}
IValue returnValue = CodeGenerator.GetFunctionCallReturnValue(isStatic? null : dereferencedTarget, dereferencedType, targetFunctionName, chosenFunctionType, parameters);
return returnValue;
}
开发者ID:shravanrn,项目名称:Cleps,代码行数:59,代码来源:ClepsFunctionBodyGeneratorVisitor_FunctionCall.cs
注:本文中的IValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论