本文整理汇总了C#中TagList.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# TagList.Clear方法的具体用法?C# TagList.Clear怎么用?C# TagList.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagList
的用法示例。
在下文中一共展示了TagList.Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseList
public static TagList ParseList(JsonReader reader, string rootName)
{
TagList list = new TagList(rootName);
bool foundGeneric = false;
while (reader.Read())
{
if (reader.TokenType == JsonToken.Boolean)
{
if (!foundGeneric)
{
foundGeneric = true;
list.GenericType = ETagType.Byte;
}
bool b = (bool)reader.Value;
TagByte tag = new TagByte(null, b);
list.Add(tag);
}
else if (reader.TokenType == JsonToken.Integer)
{
if (!foundGeneric)
{
foundGeneric = true;
list.GenericType = ETagType.Long;
}
long l = (long)reader.Value;
TagLong tag = new TagLong(null, l);
list.Add(tag);
}
else if (reader.TokenType == JsonToken.Float)
{
if (!foundGeneric)
{
foundGeneric = true;
list.GenericType = ETagType.Float;
}
else if (list.GenericType == ETagType.Long)
{
List<TagDouble> buf = new List<TagDouble>();
foreach (TagLong tl in list)
{
buf.Add(new TagDouble(tl.Name, tl.Value));
}
list.Clear();
list.GenericType = ETagType.Double;
foreach (TagDouble td in buf)
{
list.Add(td);
}
}
double d = (double)reader.Value;
TagDouble tag = new TagDouble(null, d);
list.Add(tag);
}
else if (reader.TokenType == JsonToken.String)
{
if (!foundGeneric)
{
foundGeneric = true;
list.GenericType = ETagType.String;
}
string s = reader.Value as string;
TagString tag = new TagString(null, s);
list.Add(tag);
}
else if (reader.TokenType == JsonToken.StartObject)
{
if (!foundGeneric)
{
foundGeneric = true;
list.GenericType = ETagType.Compound;
}
TagCompound tag = ParseCompound(reader, null);
list.Add(tag);
}
else if (reader.TokenType == JsonToken.StartArray)
{
if (!foundGeneric)
{
foundGeneric = true;
list.GenericType = ETagType.List;
}
TagList inner = ParseList(reader, null);
list.Add(inner);
}
else if (reader.TokenType == JsonToken.EndArray)
{
return list;
}
else
{
throw new NotImplementedException("Currently no handling for this type of JSON token: " + reader.TokenType.ToString());
}
}
//.........这里部分代码省略.........