public static FormatMethod ( |
||
method | ||
Résultat | string |
public static string MemberAnchor(object obj) { string anchor = String.Empty; if (obj is Type) { anchor = ((Type)obj).FullName; } else if (obj is MethodInfo) { anchor = (IsNonconversionOperator(((MethodInfo)obj).Name)) ? ((MethodInfo)obj).Name : DocVisitor.FormatMethod((MethodInfo)obj, true); } else { anchor = (obj is PropertyInfo) ? DocVisitor.FormatProperty((PropertyInfo)obj, true) : ((obj is FieldInfo) ? ((FieldInfo)obj).Name : obj.ToString()); } anchor = anchor.Trim(); anchor = Regex.Replace(anchor, "\\(\\)", String.Empty); anchor = Regex.Replace(anchor, "\\W+", "_"); anchor = Regex.Replace(anchor, "_+$", String.Empty); return(anchor); }
public static string FormatMember(object obj) { if (obj is Type) { string m = ((Type)obj).FullName; m = Regex.Replace(m, "\\+", "."); m = Regex.Replace(m, "\\s+", " "); m = m.Trim(); return(m); } if (obj is MethodInfo) { string m = DocVisitor.FormatMethod((MethodInfo)obj, true); m = Regex.Replace(m, "\\s+", " "); m = m.Trim(); return(m); } if (obj is PropertyInfo) { string m = DocVisitor.FormatProperty((PropertyInfo)obj, true); m = Regex.Replace(m, "\\s+", " "); m = m.Trim(); return(m); } if (obj is FieldInfo) { string m = DocVisitor.FormatField((FieldInfo)obj); m = Regex.Replace(m, "\\s+", " "); m = m.Trim(); return(m); } return(obj.ToString()); }
public static string MemberAnchor(object obj) { string anchor = String.Empty; if (obj is Type) { anchor = ((Type)obj).FullName; } else if (obj is MethodInfo) { anchor = (((MethodInfo)obj).Name.IndexOf( "op_", StringComparison.Ordinal) == 0) ? ((MethodInfo)obj).Name : DocVisitor.FormatMethod((MethodInfo)obj, true); } else { anchor = (obj is PropertyInfo) ? DocVisitor.FormatProperty((PropertyInfo)obj, true) : ((obj is FieldInfo) ? ((FieldInfo)obj).Name : obj.ToString()); } anchor = anchor.Trim(); anchor = Regex.Replace(anchor, "\\(\\)", String.Empty); anchor = Regex.Replace(anchor, "\\W+", "_"); anchor = Regex.Replace(anchor, "_+$", String.Empty); return(anchor); }