コード例 #1
0
 public virtual bool IsArgument <T>(string name, T source)
 {
     if (name.EndsWith("Arg"))
     {
         return(true);
     }
     return(source switch
     {
         IPropertySymbol p => p.HasAttribute <ArgumentAttribute>(),
         IParameterSymbol p => p.HasAttribute <ArgumentAttribute>(),
         _ => throw new InvalidOperationException("Symbol type not recognized")
     });
コード例 #2
0
 private bool IsOutParameter(IParameterSymbol parameterSymbol) =>
     parameterSymbol.RefKind == RefKind.Out ||
     // Handle VB.NET special case for out parameters
     (parameterSymbol.RefKind == RefKind.Ref && parameterSymbol.HasAttribute(outAttributeSymbol));