本文整理汇总了C#中MasterList.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# MasterList.AddRange方法的具体用法?C# MasterList.AddRange怎么用?C# MasterList.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MasterList
的用法示例。
在下文中一共展示了MasterList.AddRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTypeTokenBaseName
/// <summary>
/// Gets the base name and generic symbols for a type token.
/// </summary>
/// <param name="typeTokenReference">A reference to the type token.</param>
/// <param name="typeTokens">The list of tokens in the type.</param>
/// <param name="startIndex">The start index within the symbol list.</param>
/// <param name="generic">Returns a value indicating whether the type is generic.</param>
/// <param name="unsafeCode">Indicates whether the type is within a block of unsafe code.</param>
private void GetTypeTokenBaseName(
Reference<ICodePart> typeTokenReference,
ref MasterList<CsToken> typeTokens,
ref int startIndex,
out GenericType generic,
bool unsafeCode)
{
Param.AssertNotNull(typeTokenReference, "typeTokenReference");
Param.AssertNotNull(typeTokens, "typeTokens");
Param.AssertGreaterThanOrEqualToZero(startIndex, "startIndex");
Param.Ignore(unsafeCode);
generic = null;
Symbol symbol = this.symbols.Peek(startIndex);
// First get the full name of the type.
int index = -1;
while (true)
{
// Add any whitespace.
while (symbol != null &&
(symbol.SymbolType == SymbolType.WhiteSpace ||
symbol.SymbolType == SymbolType.EndOfLine ||
symbol.SymbolType == SymbolType.SingleLineComment ||
symbol.SymbolType == SymbolType.MultiLineComment ||
symbol.SymbolType == SymbolType.PreprocessorDirective))
{
typeTokens.Add(this.ConvertSymbol(symbol, TokenTypeFromSymbolType(symbol.SymbolType), typeTokenReference));
symbol = this.symbols.Peek(++startIndex);
}
// Add the next word. The type of the next word must either be an unknown
// word type, which will be the name of the next item in the type, or else
// it must be the 'this' keyword. This is used when implementing an explicit
// interface member which is an indexer.
if (symbol.SymbolType == SymbolType.Other || symbol.SymbolType == SymbolType.This)
{
typeTokens.Add(new CsToken(symbol.Text, CsTokenType.Other, symbol.Location, typeTokenReference, this.symbols.Generated));
}
else
{
throw new SyntaxException(this.document.SourceCode, symbol.LineNumber);
}
++startIndex;
// Look at the type of the next non-whitespace character.
index = this.GetNextCodeSymbolIndex(startIndex);
if (index == -1)
{
break;
}
// If the next character is an opening generic bracket, get the generic.
symbol = this.symbols.Peek(index);
if (symbol.SymbolType == SymbolType.LessThan)
{
int end;
MasterList<CsToken> genericTypeTokens = this.GetGenericArgumentList(
typeTokenReference, unsafeCode, null, startIndex, out end);
if (genericTypeTokens != null)
{
// Add the tokens from this generic into our token list.
typeTokens.AddRange(genericTypeTokens);
// Create a new GenericTypeToken which represents this generic type.
CodeLocation genericTypeLocation = CsToken.JoinLocations(typeTokens.First, typeTokens.Last);
generic = new GenericType(typeTokens, genericTypeLocation, typeTokenReference, this.symbols.Generated);
Reference<ICodePart> genericReference = new Reference<ICodePart>(generic);
foreach (CsToken token in typeTokens)
{
token.ParentRef = genericReference;
}
// Reset the token list and add this generic token as the first item in the list.
typeTokens = new MasterList<CsToken>();
typeTokens.Add(generic);
// Advance the symbol index.
startIndex = end + 1;
// Look at the type of the next non-whitespace character.
index = this.GetNextCodeSymbolIndex(startIndex);
if (index == -1)
{
break;
}
}
}
//.........这里部分代码省略.........
示例2: GetTypeTokenBaseName
private void GetTypeTokenBaseName(ref MasterList<CsToken> typeTokens, ref int startIndex, out GenericType generic, bool unsafeCode)
{
generic = null;
Symbol symbol = this.symbols.Peek(startIndex);
int count = -1;
Label_0045:
while ((symbol != null) && ((((symbol.SymbolType == SymbolType.WhiteSpace) || (symbol.SymbolType == SymbolType.EndOfLine)) || ((symbol.SymbolType == SymbolType.SingleLineComment) || (symbol.SymbolType == SymbolType.MultiLineComment))) || (symbol.SymbolType == SymbolType.PreprocessorDirective)))
{
int num3;
typeTokens.Add(this.ConvertSymbol(symbol, TokenTypeFromSymbolType(symbol.SymbolType)));
startIndex = num3 = startIndex + 1;
symbol = this.symbols.Peek(num3);
}
if ((symbol.SymbolType != SymbolType.Other) && (symbol.SymbolType != SymbolType.This))
{
throw new SyntaxException(this.document.SourceCode, symbol.LineNumber);
}
typeTokens.Add(new CsToken(symbol.Text, CsTokenType.Other, symbol.Location, this.symbols.Generated));
startIndex++;
count = this.GetNextCodeSymbolIndex(startIndex);
if (count != -1)
{
if (this.symbols.Peek(count).SymbolType == SymbolType.LessThan)
{
int num2;
MasterList<CsToken> items = this.GetGenericArgumentList(unsafeCode, null, startIndex, out num2);
if (items != null)
{
typeTokens.AddRange(items);
CodeLocation location = CodeLocation.Join<CsToken>(typeTokens.First, typeTokens.Last);
generic = new GenericType(typeTokens, location, this.symbols.Generated);
typeTokens = new MasterList<CsToken>();
typeTokens.Add(generic);
startIndex = num2 + 1;
count = this.GetNextCodeSymbolIndex(startIndex);
if (count == -1)
{
return;
}
}
}
symbol = this.symbols.Peek(count);
if ((symbol.SymbolType == SymbolType.Dot) || (symbol.SymbolType == SymbolType.QualifiedAlias))
{
int num5;
symbol = this.symbols.Peek(startIndex);
while ((symbol != null) && ((((symbol.SymbolType == SymbolType.WhiteSpace) || (symbol.SymbolType == SymbolType.EndOfLine)) || ((symbol.SymbolType == SymbolType.SingleLineComment) || (symbol.SymbolType == SymbolType.MultiLineComment))) || (symbol.SymbolType == SymbolType.PreprocessorDirective)))
{
int num4;
typeTokens.Add(this.ConvertSymbol(symbol, TokenTypeFromSymbolType(symbol.SymbolType)));
startIndex = num4 = startIndex + 1;
symbol = this.symbols.Peek(num4);
}
if (symbol.SymbolType == SymbolType.Dot)
{
typeTokens.Add(new OperatorSymbol(symbol.Text, OperatorCategory.Reference, OperatorType.MemberAccess, symbol.Location, this.symbols.Generated));
}
else
{
typeTokens.Add(new OperatorSymbol(symbol.Text, OperatorCategory.Reference, OperatorType.QualifiedAlias, symbol.Location, this.symbols.Generated));
}
startIndex = num5 = startIndex + 1;
symbol = this.symbols.Peek(num5);
goto Label_0045;
}
}
}