本文整理汇总了C#中Symbol.GetAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.GetAttributes方法的具体用法?C# Symbol.GetAttributes怎么用?C# Symbol.GetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol.GetAttributes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultForceComplete
/// <summary>
/// Used to force (source) symbols to a given state of completion.
/// </summary>
/// <param name="symbol">The owning source symbol.</param>
internal void DefaultForceComplete(Symbol symbol)
{
Debug.Assert(symbol.RequiresCompletion);
if (!HasComplete(CompletionPart.Attributes))
{
symbol.GetAttributes();
}
}
示例2: DefaultForceComplete
/// <summary>
/// Used to force (source) symbols to a given state of completion.
/// </summary>
/// <param name="symbol">The owning source symbol.</param>
internal void DefaultForceComplete(Symbol symbol)
{
Debug.Assert(symbol.RequiresCompletion);
if (!HasComplete(CompletionPart.Attributes))
{
symbol.GetAttributes();
}
// any other values are completion parts intended for other kinds of symbols
NotePartComplete(CompletionPart.All);
}
示例3: CheckAttributes
private void CheckAttributes(Symbol s, AttributeArgs[] expected)
{
int i = 0;
foreach (var sa in s.GetAttributes())
{
int j = 0;
foreach (var pa in sa.CommonConstructorArguments)
{
CheckConstructorArg(expected[i].Pos[j], pa.Value.ToString());
j += 1;
}
j = 0;
foreach (var na in sa.CommonNamedArguments)
{
CheckNamedArg(expected[i].Named[j], na);
j += 1;
}
i += 1;
}
}
示例4: DumpAttributes
private void DumpAttributes(Symbol s)
{
int i = 0;
foreach (var sa in s.GetAttributes())
{
int j = 0;
foreach (var pa in sa.CommonConstructorArguments)
{
Console.WriteLine("{0} {1} {2}", pa.ToString());
j += 1;
}
j = 0;
foreach (var na in sa.CommonNamedArguments)
{
Console.WriteLine("{0} {1} {2} = {3}", na.Key, na.Value.ToString());
j += 1;
}
i += 1;
}
}
示例5: AppendCustomAttributes
private static void AppendCustomAttributes(StringBuilder result, Symbol symbol, string indent, bool inBlock)
{
var attributes = symbol.GetAttributes();
if (attributes.Length == 0)
{
return;
}
if (!inBlock)
{
result.Append(indent);
result.AppendLine("{");
}
string memberIndent = indent + " ";
foreach (var attribute in attributes)
{
result.Append(memberIndent);
result.Append(".custom ");
if (attribute.AttributeConstructor == null)
{
result.Append("[Missing: ");
result.Append(attribute.AttributeClass);
result.Append("]");
}
else
{
AppendMethod(result, (PEMethodSymbol)attribute.AttributeConstructor, indent: null, includeTypeName: true);
}
result.Append(" = (");
int i = 0;
foreach (var arg in attribute.ConstructorArguments)
{
if (i > 0)
{
result.Append(", ");
}
AppendConstant(result, arg);
i++;
}
foreach (var arg in attribute.NamedArguments)
{
if (i > 0)
{
result.Append(", ");
}
result.Append(arg.Key);
result.Append(" = ");
AppendConstant(result, arg.Value);
i++;
}
result.Append(")");
result.AppendLine();
}
if (!inBlock)
{
result.Append(indent);
result.AppendLine("}");
}
}
示例6: AssertNoAttributes
private static void AssertNoAttributes(Symbol symbol)
{
Assert.Equal(0, symbol.GetAttributes().Length);
}
示例7: GetSingleAttributeName
private static string GetSingleAttributeName(Symbol symbol)
{
return symbol.GetAttributes().Single().AttributeClass.Name;
}
示例8: CheckAttributePropagation
private static string CheckAttributePropagation(Symbol symbol)
{
string result = "";
if (symbol.GetAttributes("", "MyAttribute").Any())
{
result += "MyAttribute is present\n";
}
if (!symbol.GetAttributes("System.Diagnostics", "DebuggerNonUserCodeAttribute").Any())
{
result += "DebuggerNonUserCodeAttribute is missing\n";
}
if (!symbol.GetAttributes("System.Diagnostics", "DebuggerHiddenAttribute").Any())
{
result += "DebuggerHiddenAttribute is missing\n";
}
if (!symbol.GetAttributes("System.Diagnostics", "DebuggerStepperBoundaryAttribute").Any())
{
result += "DebuggerStepperBoundaryAttribute is missing\n";
}
if (!symbol.GetAttributes("System.Diagnostics", "DebuggerStepThroughAttribute").Any())
{
result += "DebuggerStepThroughAttribute is missing\n";
}
return result;
}
示例9: TestAttributeRetargeting
public void TestAttributeRetargeting(Symbol symbol)
{
// Verify GetAttributes()
TestAttributeRetargeting(symbol.GetAttributes());
// Verify GetAttributes(AttributeType from Retargeted assembly)
TestAttributeRetargeting(symbol.GetAttributes(newMsCorLib_debuggerTypeProxyAttributeType));
// Verify GetAttributes(AttributeType from Underlying assembly)
Assert.Empty(symbol.GetAttributes(oldMsCorLib_debuggerTypeProxyAttributeType));
// Verify GetAttributes(AttributeCtor from Retargeted assembly)
TestAttributeRetargeting(symbol.GetAttributes(newMsCorLib_debuggerTypeProxyAttributeType));
// Verify GetAttributes(AttributeCtor from Underlying assembly)
Assert.Empty(symbol.GetAttributes(oldMsCorLib_debuggerTypeProxyAttributeType));
// Verify GetAttributes(namespaceName, typeName, ctorSignature)
TestAttributeRetargeting(symbol.GetAttributes(s_attribute));
}