本文整理汇总了C#中IMethodSymbol.GetIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodSymbol.GetIdentifier方法的具体用法?C# IMethodSymbol.GetIdentifier怎么用?C# IMethodSymbol.GetIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodSymbol
的用法示例。
在下文中一共展示了IMethodSymbol.GetIdentifier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParsedMethod
private SDMethod GetParsedMethod(IMethodSymbol method, bool isCtor)
{
var sdMethod = ParserOptions.SDRepository.GetMethodByIdentifier(method.GetIdentifier());
if (sdMethod != null)
{
return sdMethod;
}
var returnType = _typeRefParser.GetParsedTypeReference(method.ReturnType);
var syntaxReference = method.DeclaringSyntaxReferences.Any() ? method.DeclaringSyntaxReferences.Single() : null;
sdMethod = new SDMethod(method.GetIdentifier(), isCtor ? method.ContainingType.Name : method.Name)
{
Namespace = method.ContainingNamespace.GetIdentifier(),
DeclaringType = _typeRefParser.GetParsedTypeReference(method.ContainingType),
ReturnType = returnType,
IsCtor = isCtor,
Accessibility = method.DeclaredAccessibility.ToString().ToLower(),
IsAbstract = method.IsAbstract,
IsOverride = method.IsOverride,
IsPrivate = method.DeclaredAccessibility == Accessibility.Private,
IsProtected = method.DeclaredAccessibility == Accessibility.Protected,
IsPublic = method.DeclaredAccessibility == Accessibility.Public,
IsSealed = method.IsSealed,
IsVirtual = method.IsVirtual,
IsStatic = method.IsStatic,
Documentations = DocumentationParser.ParseDocumentation(method),
Region = syntaxReference != null ? new SDRegion
{
Start = syntaxReference.Span.Start,
End = syntaxReference.Span.End,
Filename = syntaxReference.SyntaxTree.FilePath
} : null
};
foreach (var typeParameter in method.TypeParameters)
{
sdMethod.TypeParameters.Add(_typeRefParser.GetParsedTypeReference(typeParameter));
}
foreach (var parameter in method.Parameters)
{
sdMethod.Parameters.Add(new SDParameter
{
Name = parameter.Name,
ParamType = _typeRefParser.GetParsedTypeReference(parameter.Type),
IsOptional = parameter.IsOptional,
IsConst = parameter.HasExplicitDefaultValue,
ConstantValue = parameter.HasExplicitDefaultValue ? parameter.ExplicitDefaultValue?.ToString() ?? "null" : null,
IsRef = parameter.RefKind == RefKind.Ref,
IsOut = parameter.RefKind == RefKind.Out
});
}
ParserOptions.SDRepository.AddMethod(sdMethod);
return sdMethod;
}