本帖最后由 zeroarst 于 2010-02-06 14:44:27 编辑

解决方案 »

  1.   

    把重复的那部分拿出来,选中公共部分右键点击refactor->extract method就好了
      

  2.   

    public static bool isRowDuplicate(DataTable dt, DataRow dr)
    {
       return isRowDuplicate(dt,dr,false,null);
    }
      

  3.   

    把相同的部分提出来定义一个私有的方法,然后再调用。就可以。
    比如:
    public class MyClass
    {
    private static void Method()
    {
       //相同部分的代码
    }public static bool isRowDuplicate(DataTable dt, DataRow dr) 
    {
      //其他代码
      Method();
    }
    public static bool isRowDuplicate(DataTable dt, DataRow dr, bool excludeColumnCaseSensitive, params string[] excludeColunmnNames)
    {
      //其他代码
      Method();
    }
    }