比較三種分組方案:
public static ChineseString AsChineseString(this string s)
=> new ChineseString(s);
缺點:智能提示混雜 Equals/GetHashCode/ToString,無擴展方法圖示。
public class ChineseString { ... }
public static class ChineseStringExtension {
public static string ToSBC(this ChineseString cs) { ... }
}
優點:擴展方法有專屬圖示。缺點:每組需兩個類別,維護成本高。
智能提示乾淨:AsChineseString、AsConvertableString、AsRegexableString 以 As 開頭排在最前,進入後僅顯示該群組擴展方法。