public static string GetResolutionScope(ITypeReference value) { IModule module = value.Owner as IModule; if (module != null) { return(value.Namespace); } ITypeDeclaration declaringType = value.Owner as ITypeDeclaration; if (declaringType != null) { return(Helper.GetResolutionScope(declaringType) + "+" + Helper.GetName(declaringType)); } throw new NotSupportedException(); }
public static string GetNameWithResolutionScope(ITypeReference value) { if (value != null) { ITypeReference declaringType = value.Owner as ITypeReference; if (declaringType != null) { return(Helper.GetNameWithResolutionScope(declaringType) + "+" + Helper.GetName(value)); } string namespaceName = value.Namespace; if (namespaceName.Length == 0) { return(Helper.GetName(value)); } return(namespaceName + "." + Helper.GetName(value)); } throw new NotSupportedException(); }
public static string GetNameWithParameterList(IMethodReference value) { using (StringWriter writer = new StringWriter(CultureInfo.InvariantCulture)) { writer.Write(Helper.GetName(value)); writer.Write("("); IParameterDeclarationCollection parameters = value.Parameters; for (int i = 0; i < parameters.Count; i++) { if (i != 0) { writer.Write(", "); } writer.Write(parameters[i].ParameterType.ToString()); } if (value.CallingConvention == MethodCallingConvention.VariableArguments) { if (value.Parameters.Count > 0) { writer.Write(", "); } writer.Write("..."); } writer.Write(")"); if ((value.Name != ".ctor") && (value.Name != ".cctor")) { writer.Write(" : "); writer.Write(value.ReturnType.Type.ToString()); } return(writer.ToString()); } }
public static string GetNameWithDeclaringType(IEventReference value) { return(Helper.GetNameWithResolutionScope(value.DeclaringType as ITypeReference) + "." + Helper.GetName(value)); }