本文整理汇总了C#中VList.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# VList.Clear方法的具体用法?C# VList.Clear怎么用?C# VList.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VList
的用法示例。
在下文中一共展示了VList.Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OtherStmt
//.........这里部分代码省略.........
{
la1 = LA(1);
if (la1 == TT.Colon)
goto matchLabelStmt;
else if (la1 == TT.LParen)
goto matchExprStatement;
else
goto error;
}
case TT.Add:
case TT.AndBits:
case TT.Dot:
case TT.DotDot:
case TT.Forward:
case TT.IncDec:
case TT.LParen:
case TT.Mul:
case TT.Not:
case TT.Power:
case TT.Sub:
case TT.Substitute:
goto matchExprStatement;
case TT.Operator:
{
la1 = LA(1);
switch (la1) {
case TT.ContextualKeyword:
case TT.Id:
case TT.Operator:
case TT.TypeKeyword:
{
result = OperatorCastMethod(startIndex, attrs);
// line 1468
attrs.Clear();
}
break;
default:
if (AnyOperator_set0.Contains((int) la1))
goto matchExprStatement;
else
goto error;
}
}
break;
case TT.This:
{
la1 = LA(1);
switch (la1) {
case TT.ContextualKeyword:
case TT.Id:
case TT.Operator:
case TT.Substitute:
case TT.TypeKeyword:
{
ths = MatchAny();
Check(Try_OtherStmt_Test1(0), "DataType ComplexNameDecl");
// line 1471
attrs.Add(F.Id(ths));
result = MethodOrPropertyOrVar(startIndex, attrs);
}
break;
default:
if (OtherStmt_set1.Contains((int) la1))
goto matchExprStatement;
else
goto error;
示例2: OtherStmt
// Statements that don't start with an Id and don't allow keyword attributes.
LNode OtherStmt(int startIndex, VList<LNode> attrs, bool hasWordAttrs)
{
TokenType la1;
Token lit_semi = default(Token);
LNode result = default(LNode);
bool addAttrs = false;
string showWordAttrErrorFor = null;
// Line 1391: ( BracedBlock / &(TT.NotBits (TT.ContextualKeyword|TT.Id|TT.This) TT.LParen TT.RParen TT.LBrace TT.RBrace) Destructor / TT.Semicolon / LabelStmt / default ExprStatement / AssemblyOrModuleAttribute / OperatorCastMethod )
do {
switch (LA0) {
case TT.LBrace:
{
result = BracedBlock(null, null, startIndex);
// line 1392
showWordAttrErrorFor = "braced-block statement";
addAttrs = true;
}
break;
case TT.NotBits:
{
if (Try_OtherStmt_Test0(0)) {
la1 = LA(1);
if (la1 == TT.ContextualKeyword || la1 == TT.Id || la1 == TT.This) {
result = Destructor(startIndex, attrs);
// line 1395
showWordAttrErrorFor = "destructor";
} else if (OtherStmt_set0.Contains((int) la1))
goto matchExprStatement;
else
goto error;
} else
goto matchExprStatement;
}
break;
case TT.Semicolon:
{
lit_semi = MatchAny();
// line 1396
result = F.Id(S.Missing, startIndex, lit_semi.EndIndex);
showWordAttrErrorFor = "empty statement";
addAttrs = true;
}
break;
case TT.ContextualKeyword:
{
if (Is(0, _await)) {
la1 = LA(1);
if (la1 == TT.Colon)
goto matchLabelStmt;
else if (OtherStmt_set1.Contains((int) la1))
goto matchExprStatement;
else
goto error;
} else {
la1 = LA(1);
if (la1 == TT.Colon)
goto matchLabelStmt;
else if (OtherStmt_set2.Contains((int) la1))
goto matchExprStatement;
else
goto error;
}
}
case TT.Id:
{
la1 = LA(1);
if (la1 == TT.Colon)
goto matchLabelStmt;
else if (OtherStmt_set2.Contains((int) la1))
goto matchExprStatement;
else
goto error;
}
case TT.Default:
{
la1 = LA(1);
if (la1 == TT.Colon)
goto matchLabelStmt;
else if (la1 == TT.LParen)
goto matchExprStatement;
else
goto error;
}
case TT.Add: case TT.AndBits: case TT.Break: case TT.Continue:
case TT.DotDot: case TT.Forward: case TT.Goto: case TT.IncDec:
case TT.LParen: case TT.Mul: case TT.Not: case TT.Power:
case TT.Return: case TT.Sub: case TT.Substitute: case TT.Switch:
case TT.Throw:
goto matchExprStatement;
case TT.Operator:
{
la1 = LA(1);
switch (la1) {
case TT.ContextualKeyword: case TT.Id: case TT.Operator: case TT.TypeKeyword:
{
result = OperatorCastMethod(startIndex, attrs);
// line 1404
attrs.Clear();
}
//.........这里部分代码省略.........
示例3: TestInsertRemove
public void TestInsertRemove()
{
VList<int> list = new VList<int>(9);
VList<int> list2 = new VList<int>(10, 11);
list.Insert(0, 12);
list.Insert(1, list2[1]);
list.Insert(2, list2[0]);
ExpectList(list, 12, 11, 10, 9);
for (int i = 0; i < 9; i++)
list.Insert(4, i);
ExpectList(list, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
list2 = list;
for (int i = 1; i <= 6; i++)
list2.RemoveAt(i);
ExpectList(list2, 12, 10, 8, 6, 4, 2, 0);
ExpectList(list, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // unchanged
Assert.AreEqual(0, list2.Pop());
list2.Insert(5, -2);
ExpectList(list2, 12, 10, 8, 6, 4, -2, 2);
list2.Insert(5, -1);
ExpectList(list2, 12, 10, 8, 6, 4, -1, -2, 2);
// Test changing items
list = list2;
for (int i = 0; i < list.Count; i++)
list[i] = i;
ExpectList(list, 0, 1, 2, 3, 4, 5, 6, 7);
ExpectList(list2, 12, 10, 8, 6, 4, -1, -2, 2);
list2.Clear();
ExpectList(list2);
Assert.AreEqual(5, list[5]);
}