本文整理汇总了C#中HeD.Model.List.Add方法的典型用法代码示例。如果您正苦于以下问题:C# List.Add方法的具体用法?C# List.Add怎么用?C# List.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HeD.Model.List
的用法示例。
在下文中一共展示了List.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Verify
public void Verify(VerificationContext context, ASTNode node)
{
// objectType
var objectTypeName = node.GetAttribute<string>("classType");
if (objectTypeName != null)
{
var objectType = context.ResolveType(node.GetAttribute<string>("classType")) as ObjectType;
// foreach property
foreach (var child in ((Node)node).Children)
{
if (child.Name == "element")
{
// Verify the property exists
var childPropertyType = context.ResolveProperty(objectType, child.GetAttribute<string>("name"));
// Verify the value
var value = (ASTNode)child.Children[0];
Verifier.Verify(context, value);
// Verify the value type is appropriate for the property type
context.VerifyType(value.ResultType, childPropertyType);
}
}
node.ResultType = objectType;
}
else
{
var propertyList = new List<PropertyDef>();
foreach (var child in ((Node)node).Children)
{
if (child.Name == "element")
{
var value = (ASTNode)child.Children[0];
Verifier.Verify(context, value);
var property = new PropertyDef(child.GetAttribute<string>("name"), value.ResultType);
propertyList.Add(property);
}
}
var objectType = new ObjectType(Guid.NewGuid().ToString(), propertyList);
node.ResultType = objectType;
}
}
示例2: InternalVerify
protected override void InternalVerify(VerificationContext context, ASTNode node)
{
base.InternalVerify(context, node);
var dataTypes = new List<DataType>();
foreach (var child in node.Children)
{
if (child.ResultType == null)
{
throw new InvalidOperationException(String.Format("Could not determine type of '{0}' expression.", child.Name));
}
dataTypes.Add(child.ResultType);
}
var op = context.ResolveCall(GetOperatorName(node), new Signature(dataTypes));
node.ResultType = op.ResultType;
}
示例3: ResolveProperties
private static IEnumerable<PropertyDef> ResolveProperties(Type type)
{
var properties = new List<PropertyDef>();
foreach (var property in type.GetProperties())
{
// For choice elements, the element names should appear traversible as properties, otherwise there would be no way to access the value
// (HeD does not have a Cast, and the xsd doesn't actually have a property named Item, which is how choices deserialize)
var propertyAdded = false;
foreach (var attribute in property.GetCustomAttributes(typeof(XmlElementAttribute), false).OfType<XmlElementAttribute>())
{
if (!string.IsNullOrEmpty(attribute.ElementName) && attribute.Type != null && attribute.Type != type)
{
properties.Add(new PropertyDef(attribute.ElementName, ResolveType(attribute.Type)));
propertyAdded = true;
}
}
if (!propertyAdded)
{
properties.Add(new PropertyDef(property.Name, ResolveType(property.PropertyType)));
}
}
return properties;
}