本文整理汇总了C#中java.util.ArrayList.clear方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.clear方法的具体用法?C# ArrayList.clear怎么用?C# ArrayList.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.ArrayList
的用法示例。
在下文中一共展示了ArrayList.clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parsePackageBody
private PackageBodyNode parsePackageBody(bool global, int startPosition) {
var result = new PackageBodyNode { StartPosition = startPosition };
startPosition = scanner.StartPosition;
while (lexicalUnit == LexicalUnit.Keyword && scanner.Keyword == Keyword.Using) {
if (!isIdentifier(nextLexicalUnit(true))) {
throw error(ParseErrorId.IdentifierExpected);
}
var usingDirective = new UsingDirectiveNode { StartPosition = startPosition };
setScannerState(usingDirective);
result.UsingDirectives.add(usingDirective);
int sp = scanner.StartPosition;
int len = getLexicalUnitLength();
var restorePoint = this.createRestorePoint();
if (nextLexicalUnit(true) == LexicalUnit.Assign) {
usingDirective.AliasOffset = sp;
usingDirective.AliasLength = len;
nextLexicalUnit(true);
} else {
restore(restorePoint);
}
usingDirective.TypeOrPackage = parsePackageOrTypeName(true);
usingDirective.EndPosition = parseSemiColon(false, false);
}
var done = false;
var modifiers = EnumSet.noneOf(typeof(Modifier));
var annotations = new ArrayList<AnnotationSectionNode>();
do {
switch (lexicalUnit) {
case Keyword:
case ContextualKeyword:
switch (scanner.Keyword) {
case Package:
if (modifiers.size() > 0) {
addError(ParseErrorId.PackageWithModifiers);
modifiers.clear();
}
var ns = new PackageDeclarationNode { StartPosition = scanner.StartPosition };
if (docCommentEndPosition > 0) {
ns.DocumentationOffset = docCommentStartPosition;
ns.DocumentationLength = docCommentEndPosition - docCommentStartPosition;
docCommentEndPosition = 0;
}
setScannerState(ns);
ns.Annotations.addAll(annotations);
annotations.clear();
do {
if (!isIdentifier(nextLexicalUnit(true))) {
throw error(ParseErrorId.IdentifierExpected);
}
var part = new SourceCodePartNode { Offset = scanner.StartPosition, Length = getLexicalUnitLength() };
setScannerState(part);
ns.Identifiers.add(part);
} while (nextLexicalUnit(true) == LexicalUnit.Dot);
if (lexicalUnit != LexicalUnit.OpenBrace) {
throw error(ParseErrorId.OpenBraceExpected);
}
startPosition = scanner.StartPosition;
if (nextLexicalUnit(true) != LexicalUnit.CloseBrace) {
ns.Body = parsePackageBody(false, startPosition);
}
if (lexicalUnit != LexicalUnit.CloseBrace) {
throw error(ParseErrorId.CloseBraceExpected);
}
ns.EndPosition = scanner.EndPosition;
if (nextLexicalUnit(false) == LexicalUnit.SemiColon) {
nextLexicalUnit(false);
}
result.Members.add(ns);
break;
case Public:
if (modifiers.size() == 0) {
startPosition = scanner.StartPosition;
}
addModifier(modifiers, Modifier.Public);
nextLexicalUnit(true);
break;
case Protected:
if (modifiers.size() == 0) {
startPosition = scanner.StartPosition;
}
addModifier(modifiers, Modifier.Protected);
nextLexicalUnit(true);
break;
case Private:
if (modifiers.size() == 0) {
startPosition = scanner.StartPosition;
}
addModifier(modifiers, Modifier.Private);
nextLexicalUnit(true);
break;
case Abstract:
if (modifiers.size() == 0) {
startPosition = scanner.StartPosition;
}
addModifier(modifiers, Modifier.Abstract);
//.........这里部分代码省略.........