zoukankan      html  css  js  c++  java
  • 发现自己的代码写的越来越玄幻了

    //_________________________________________________//

    //      Description :   发现自己的代码写的越来越玄幻了                 //

    //      CODER      :    Ghost                                                  //

    //       Time          :    2011-6-10                                          //

    //_________________________________________________//

    //  更新在最后   Add by Ghost

    也许我该这样写

     int  Max(int a,int b)

    {

          int x;

         if(a>b)

      {

                x=a;

         }

        else

        {

               x=b;

         }

         return x;

    }

    其实我是这样写的

    int  Max(int a,int b)

    {

           return a>b?a:b;

    }

    也许我该这样写

    GroupInfoControl groupcontrol  = null;

    Guid id = group.Id;

    if(id .Equals(Guid.Empty))

    {

         groupcontrol = new GroupInfoControl(group, true,false);

    }

    else

    {

        groupcontrol = new GroupInfoControl(group, false,false);

    }

    其实我是这样写的

     GroupInfoControl groupcontrol = new GroupInfoControl(group, !group.Id.Equals(Guid.Empty), false);

    其实我是这样写的

    private void GroupBtnDel_Click(object sender, RoutedEventArgs e)
     {
                if (MessageBox.Show("确认要删除分组: " + GetSelectGroup().Name + " ?", "", MessageBox Button.OKCancel).Equals(MessageBoxResult.OK))  

                        client.DeleteGroupAsync(UserID, GetSelectGroup().Id.ToString());
    }

    其实我是这样写的

            void groupEditWindow_Closed(object sender, EventArgs e)
            {

                   if (((GroupEditChildWindow)sender).DialogResult ?? true)   Refresh();
            }

    其实我是这样写的

             private RMTabItem GetOpenTabItem(Guid hrID)
            {
                RMTabItem item = null;

                foreach (var p in this.TabControlMain.Items)
                {
                    if (p.GetType().Equals(typeof(RMTabItem)))
                    {
                      if (((FriendDetailControl)((RMTabItem)p).Content).FriendInfo.Id.Equals(hrID))

                       {
                            item = p as RMTabItem;
                            break;
                        }
                    }
                }

                return item;
            }

    其实我是这样写的

            public HRInfo GetHRbyID(string userid, string hrID)
            {
                 return LoadUser(userid).IsOK ? new HRInfo(uBL.GetHRByKey(new Guid(hrID))) : null;
            } 

    其实我是这样写的

            private List<GhostTreeViewItem> GetAllRoot()
            {
                return (from p in DataList where p.Parentid ==null select p).ToList();
            }

    也许我该这样写

               string result;

                if (str == null)
                {
                    result = "";
                }
                else
                {
                    if (str.Length > length)
                    {
                        result = str.Substring(0, length);
                        result = result + "..";
                    }
                    else
                    {
                        result = str;
                    }
                }

                return result;

    其实我是这样写的

             return str == null ? "" : (str.Length > length ? str.Substring(0, length) + ".." : str);

         未完待续。。。。。 

  • 相关阅读:
    Log4j appender、layout
    EhCache缓存框架的使用
    Log4j rootLogger根配置以及4种日志级别
    开发chrome 插件, background.js中 console log 看不到解决方法
    Windows cmd 长时间不输出新内容 直到按下ctrl + c 取消或者回车的解决办法
    如何查看当前分支从哪个支线创建而来
    C# 获取相对路径的字符串
    解决adobe air sdk打包 apk后自动在包名前面加上air. (有个点)前缀的问题
    sublime text 输入法候选词不跟随光标
    Windows 批处理设置dns ,解决能上qq不能开网页
  • 原文地址:https://www.cnblogs.com/GhostZCH/p/2125604.html
Copyright © 2011-2022 走看看