本文整理汇总了C#中System.CodeDom.CodeAttributeDeclarationCollection.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# CodeAttributeDeclarationCollection.GetEnumerator方法的具体用法?C# CodeAttributeDeclarationCollection.GetEnumerator怎么用?C# CodeAttributeDeclarationCollection.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CodeDom.CodeAttributeDeclarationCollection
的用法示例。
在下文中一共展示了CodeAttributeDeclarationCollection.GetEnumerator方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OutputAttributes
private void OutputAttributes(CodeAttributeDeclarationCollection attributes, bool inLine, string prefix, bool closingLine)
{
if (attributes.Count != 0)
{
IEnumerator enumerator = attributes.GetEnumerator();
bool flag = true;
this.GenerateAttributeDeclarationsStart(attributes);
while (enumerator.MoveNext())
{
if (flag)
{
flag = false;
}
else
{
base.Output.Write(", ");
if (!inLine)
{
this.ContinueOnNewLine("");
base.Output.Write(" ");
}
}
if ((prefix != null) && (prefix.Length > 0))
{
base.Output.Write(prefix);
}
CodeAttributeDeclaration current = (CodeAttributeDeclaration)enumerator.Current;
if (current.AttributeType != null)
{
base.Output.Write(this.GetTypeOutput(current.AttributeType));
}
base.Output.Write("(");
bool flag2 = true;
foreach (CodeAttributeArgument argument in current.Arguments)
{
if (flag2)
{
flag2 = false;
}
else
{
base.Output.Write(", ");
}
this.OutputAttributeArgument(argument);
}
base.Output.Write(")");
}
this.GenerateAttributeDeclarationsEnd(attributes);
base.Output.Write(" ");
if (!inLine)
{
if (closingLine)
{
base.Output.WriteLine();
}
else
{
this.ContinueOnNewLine("");
}
}
}
}
示例2: OutputAttributeDeclarations
protected virtual void OutputAttributeDeclarations (CodeAttributeDeclarationCollection attributes)
{
GenerateAttributeDeclarationsStart (attributes);
IEnumerator enumerator = attributes.GetEnumerator();
if (enumerator.MoveNext()) {
CodeAttributeDeclaration attribute = (CodeAttributeDeclaration)enumerator.Current;
OutputAttributeDeclaration (attribute);
while (enumerator.MoveNext()) {
attribute = (CodeAttributeDeclaration)enumerator.Current;
output.WriteLine (',');
OutputAttributeDeclaration (attribute);
}
}
GenerateAttributeDeclarationsEnd (attributes);
}
示例3: OutputAttributes
private void OutputAttributes (CodeAttributeDeclarationCollection attributes, string prefix, LineHandling lineHandling) {
if (attributes.Count == 0) {
return;
}
GenerateAttributeDeclarationsStart (attributes);
IEnumerator enumerator = attributes.GetEnumerator ();
if (enumerator.MoveNext ()) {
CodeAttributeDeclaration att = (CodeAttributeDeclaration) enumerator.Current;
if (prefix != null) {
Output.Write (prefix);
}
OutputAttributeDeclaration (att);
while (enumerator.MoveNext ()) {
Output.Write (", ");
if (lineHandling != LineHandling.InLine) {
ContinueOnNewLine ("");
Output.Write (" ");
}
att = (CodeAttributeDeclaration) enumerator.Current;
if (prefix != null) {
Output.Write (prefix);
}
OutputAttributeDeclaration (att);
}
}
GenerateAttributeDeclarationsEnd (attributes);
Output.Write (" ");
switch (lineHandling) {
case LineHandling.ContinueLine:
ContinueOnNewLine ("");
break;
case LineHandling.NewLine:
Output.WriteLine ();
break;
}
}
示例4: GenerateAttributes
private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine) {
if (attributes.Count == 0) return;
IEnumerator en = attributes.GetEnumerator();
bool paramArray =false;
while (en.MoveNext()) {
// we need to convert paramArrayAttribute to params keyword to
// make csharp compiler happy. In addition, params keyword needs to be after
// other attributes.
CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
if( current.Name.Equals("system.paramarrayattribute", StringComparison.OrdinalIgnoreCase)) {
paramArray = true;
continue;
}
GenerateAttributeDeclarationsStart(attributes);
if (prefix != null) {
Output.Write(prefix);
}
if( current.AttributeType != null) {
Output.Write(GetTypeOutput(current.AttributeType));
}
Output.Write("(");
bool firstArg = true;
foreach (CodeAttributeArgument arg in current.Arguments) {
if (firstArg) {
firstArg = false;
}
else {
Output.Write(", ");
}
OutputAttributeArgument(arg);
}
Output.Write(")");
GenerateAttributeDeclarationsEnd(attributes);
if (inLine) {
Output.Write(" ");
}
else {
Output.WriteLine();
}
}
if( paramArray) {
if (prefix != null) {
Output.Write(prefix);
}
Output.Write("params");
if (inLine) {
Output.Write(" ");
}
else {
Output.WriteLine();
}
}
}
示例5: GenerateAttributes
private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine) {
if (attributes.Count == 0) return;
IEnumerator en = attributes.GetEnumerator();
while (en.MoveNext()) {
GenerateAttributeDeclarationsStart(attributes);
if (prefix != null) {
Output.Write(prefix);
}
CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
Output.Write(GetBaseTypeOutput(current.Name));
Output.Write("(");
bool firstArg = true;
foreach (CodeAttributeArgument arg in current.Arguments) {
if (firstArg) {
firstArg = false;
}
else {
Output.Write(", ");
}
OutputAttributeArgument(arg);
}
Output.Write(")");
GenerateAttributeDeclarationsEnd(attributes);
if (inLine) {
Output.Write(" ");
}
else {
Output.WriteLine();
}
}
}
示例6: OutputAttributeDeclarations
/// <devdoc>
/// <para>
/// Generates code for the specified System.CodeDom.CodeAttributeBlock.
/// </para>
/// </devdoc>
protected virtual void OutputAttributeDeclarations(CodeAttributeDeclarationCollection attributes) {
if (attributes.Count == 0) return;
GenerateAttributeDeclarationsStart(attributes);
bool first = true;
IEnumerator en = attributes.GetEnumerator();
while (en.MoveNext()) {
if (first) {
first = false;
}
else {
ContinueOnNewLine(", ");
}
CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
Output.Write(current.Name);
Output.Write("(");
bool firstArg = true;
foreach (CodeAttributeArgument arg in current.Arguments) {
if (firstArg) {
firstArg = false;
}
else {
Output.Write(", ");
}
OutputAttributeArgument(arg);
}
Output.Write(")");
}
GenerateAttributeDeclarationsEnd(attributes);
}
示例7: ValidateAttributes
private void ValidateAttributes(CodeAttributeDeclarationCollection attributes) {
if (attributes.Count == 0) return;
IEnumerator en = attributes.GetEnumerator();
while (en.MoveNext()) {
CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
ValidateTypeName(current,"Name",current.Name);
ValidateTypeReference(current.AttributeType);
foreach (CodeAttributeArgument arg in current.Arguments) {
ValidateAttributeArgument(arg);
}
}
}
示例8: GenerateAssemblyAttributes
private void GenerateAssemblyAttributes(CodeAttributeDeclarationCollection attributes) {
if (attributes.Count == 0) return;
IEnumerator en = attributes.GetEnumerator();
while (en.MoveNext()) {
Output.Write("[");
Output.Write("assembly: ");
CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
Output.Write(GetBaseTypeOutput(current.Name));
Output.Write("(");
bool firstArg = true;
foreach (CodeAttributeArgument arg in current.Arguments) {
if (firstArg) {
firstArg = false;
} else {
Output.Write(", ");
}
OutputAttributeArgument(arg);
}
Output.Write(")");
Output.Write("]");
Output.WriteLine();
}
}
示例9: GenerateAttributes
private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine)
{
if (attributes.Count != 0)
{
IEnumerator enumerator1 = attributes.GetEnumerator();
bool flag1 = false;
while (enumerator1.MoveNext())
{
CodeAttributeDeclaration declaration1 = (CodeAttributeDeclaration) enumerator1.Current;
if (declaration1.Name.Equals("system.paramarrayattribute", StringComparison.OrdinalIgnoreCase))
{
flag1 = true;
}
else
{
this.GenerateAttributeDeclarationsStart(attributes);
if (prefix != null)
{
this.Output.Write(prefix);
}
if (declaration1.AttributeType != null)
{
this.Output.Write(this.GetTypeOutput(declaration1.AttributeType));
}
this.Output.Write("(");
bool flag2 = true;
foreach (CodeAttributeArgument argument1 in declaration1.Arguments)
{
if (flag2)
{
flag2 = false;
}
else
{
this.Output.Write(", ");
}
this.OutputAttributeArgument(argument1);
}
this.Output.Write(")");
this.GenerateAttributeDeclarationsEnd(attributes);
if (inLine)
{
this.Output.Write(" ");
continue;
}
this.Output.WriteLine();
}
}
if (flag1)
{
if (prefix != null)
{
this.Output.Write(prefix);
}
this.Output.Write("params");
if (inLine)
{
this.Output.Write(" ");
}
else
{
this.Output.WriteLine();
}
}
}
}
示例10: OutputAttributeDeclarations
// Generates code for the specified System.CodeDom.CodeAttributeBlock.
protected override void OutputAttributeDeclarations(CodeAttributeDeclarationCollection attributes) {
if (attributes.Count == 0) return;
GenerateAttributeDeclarationsStart(attributes);
IEnumerator en = attributes.GetEnumerator();
while (en.MoveNext()) {
CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
Output.Write(GetBaseTypeOutput(current.Name));
Output.Write("(");
bool firstArg = true;
foreach (CodeAttributeArgument arg in current.Arguments) {
if (firstArg) {
firstArg = false;
} else {
Output.Write(", ");
}
OutputAttributeArgument(arg);
}
Output.Write(") ");
}
GenerateAttributeDeclarationsEnd(attributes);
}
示例11: OutputAttributes
private void OutputAttributes(CodeAttributeDeclarationCollection attributes, bool inLine, string prefix, bool closingLine) {
if (attributes.Count == 0) return;
IEnumerator en = attributes.GetEnumerator();
bool firstAttr = true;
GenerateAttributeDeclarationsStart(attributes);
while (en.MoveNext()) {
if (firstAttr) {
firstAttr = false;
}
else {
Output.Write(", ");
if (!inLine) {
ContinueOnNewLine("");
Output.Write(" ");
}
}
if (prefix != null && prefix.Length > 0) {
Output.Write(prefix);
}
CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
if( current.AttributeType != null) {
Output.Write(GetTypeOutput(current.AttributeType));
}
Output.Write("(");
bool firstArg = true;
foreach (CodeAttributeArgument arg in current.Arguments) {
if (firstArg) {
firstArg = false;
}
else {
Output.Write(", ");
}
OutputAttributeArgument(arg);
}
Output.Write(")");
}
GenerateAttributeDeclarationsEnd(attributes);
Output.Write(" ");
if (!inLine) {
if (closingLine) {
Output.WriteLine();
}
else {
ContinueOnNewLine("");
}
}
}
示例12: GenerateAttributes
private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine)
{
if (attributes.Count != 0)
{
IEnumerator enumerator = attributes.GetEnumerator();
while (enumerator.MoveNext())
{
this.GenerateAttributeDeclarationsStart(attributes);
if (prefix != null)
{
if (string.Compare(prefix, "assembly: ", false, CultureInfo.InvariantCulture) == 0)
{
base.Output.Write("@assembly ");
}
else if (string.Compare(prefix, "return: ", false, CultureInfo.InvariantCulture) == 0)
{
base.Output.Write("@attribute.return ");
}
else
{
base.Output.Write("@attribute ");
}
}
else
{
base.Output.Write("@attribute ");
}
CodeAttributeDeclaration current = (CodeAttributeDeclaration) enumerator.Current;
string baseTypeOutput = this.GetBaseTypeOutput(current.Name);
base.Output.Write(baseTypeOutput);
base.Output.Write("(");
bool flag = true;
foreach (CodeAttributeArgument argument in current.Arguments)
{
if (flag)
{
flag = false;
}
else
{
base.Output.Write(", ");
}
this.fIsAttributeArg = true;
this.OutputAttributeArgument(argument);
this.fIsAttributeArg = false;
}
base.Output.Write(")");
this.GenerateAttributeDeclarationsEnd(attributes);
if (inLine)
{
base.Output.Write(" ");
}
else
{
base.Output.WriteLine();
}
}
}
}
示例13: GenerateAttributes
private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine)
{
if (attributes.Count != 0)
{
IEnumerator enumerator = attributes.GetEnumerator();
while (enumerator.MoveNext())
{
CodeAttributeDeclaration current = (CodeAttributeDeclaration)enumerator.Current;
this.GenerateAttributeDeclarationsStart(attributes);
if (prefix != null)
{
base.Output.Write(prefix + ": ");
}
else
{
base.Output.Write("@@");
}
if (current.AttributeType != null)
{
base.Output.Write(this.GetTypeOutput(current.AttributeType));
}
base.Output.Write("(");
bool flag = true;
foreach (CodeAttributeArgument argument in current.Arguments)
{
if (flag)
{
flag = false;
}
else
{
base.Output.Write(", ");
}
this.OutputAttributeArgument(argument);
}
base.Output.Write(")");
this.GenerateAttributeDeclarationsEnd(attributes);
if (inLine)
{
base.Output.Write(" ");
}
else
{
base.Output.WriteLine();
}
}
}
}
示例14: OutputAttributeDeclarations
protected virtual void OutputAttributeDeclarations(CodeAttributeDeclarationCollection attributes)
{
if (attributes.Count != 0)
{
this.GenerateAttributeDeclarationsStart(attributes);
bool flag = true;
IEnumerator enumerator = attributes.GetEnumerator();
while (enumerator.MoveNext())
{
if (flag)
{
flag = false;
}
else
{
this.ContinueOnNewLine(", ");
}
CodeAttributeDeclaration current = (CodeAttributeDeclaration) enumerator.Current;
this.Output.Write(current.Name);
this.Output.Write("(");
bool flag2 = true;
foreach (CodeAttributeArgument argument in current.Arguments)
{
if (flag2)
{
flag2 = false;
}
else
{
this.Output.Write(", ");
}
this.OutputAttributeArgument(argument);
}
this.Output.Write(")");
}
this.GenerateAttributeDeclarationsEnd(attributes);
}
}