public override string GetSignature() { var mods = GetModifiers(); var modString = mods.Any() ? $"{string.Join(" ", mods)} " : ""; var parameters = ResolveParameters(invokeMethod.GetParameters(), context: invokeMethod); var parameterString = string.Join(", ", parameters); var constraints = ResolveConstraints(TypeInfo.GetGenericArguments()); var constraintString = constraints.Any() ? $" {string.Join(" ", constraints)}" : ""; var returnType = invokeMethod.ReturnType.ResolveQualifiedName(ApiMethodInfo.GetReturnTypeNullability(invokeMethod)); var name = TypeInfo.ResolveQualifiedName(); return($"{modString}delegate {returnType} {name}{FormatGenericArgs(invokeMethod)}({parameterString}){constraintString};"); }
public override string FormatForApiOutput(int indentLevel = 0) { var mods = GetModifiers(); var modString = mods.Any() ? $"{string.Join(" ", mods)} " : ""; var parameters = ResolveParameters(invokeMethod.GetParameters(), context: invokeMethod); var parameterString = string.Join(", ", parameters); var constraints = ResolveConstraints(TypeInfo.GetGenericArguments()); var constraintString = constraints.Any() ? $" {string.Join(" ", constraints)}" : ""; var returnType = invokeMethod.ReturnType.ResolveQualifiedName(ApiMethodInfo.GetReturnTypeNullability(invokeMethod)); var name = TypeInfo.ResolveLocalName(TypeInfo.GetReferenceNullability()); var sig = $"{modString}delegate {returnType} {name}{FormatGenericArgs(invokeMethod)}({parameterString}){constraintString};"; return($"{new string(' ', indentLevel * IndentSpaces)}{sig}"); }
public override string GetAccessor() { var mods = GetModifiers(); var getter = GetVisibleGetter(); var setter = GetVisibleSetter(); var accessString = new StringBuilder("{"); if (getter != null) { var getterMods = new ApiMethodInfo(getter).GetModifiers().Except(mods); var getterString = getterMods.Any() ? $" {string.Join(" ", getterMods)} get;" : " get;"; accessString.Append(getterString); } if (setter != null) { var setterMods = new ApiMethodInfo(setter).GetModifiers().Except(mods); var setterString = setterMods.Any() ? $" {string.Join(" ", setterMods)} set;" : " set;"; accessString.Append(setterString); } accessString.Append(" }"); return(accessString.ToString()); }