本文整理匯總了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);
//.........這裏部分代碼省略.........