发现自己的代码写的越来越玄幻了
//_________________________________________________//
//??????Description :?? 發(fā)現(xiàn)自己的代碼寫(xiě)的越來(lái)越玄幻了???? ????? ??? ? //
//????? CODER????? :??? Ghost?????????????????????????????????????????????? ? ?//
//?????? Time????????? :??? 2011-6-10??????????????????????????????????????? ? //
//_________________________________________________//
//? 更新在最后?? Add by Ghost
也許我該這樣寫(xiě)
?int? Max(int a,int b)
{
????? int x;
???? if(a>b)
{
??????????? x=a;
???? }
??? else
??? {
?????????? x=b;
???? }
???? return x;
}
其實(shí)我是這樣寫(xiě)的
int? Max(int a,int b)
{
?????? return a>b?a:b;
}
也許我該這樣寫(xiě)
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);
}
其實(shí)我是這樣寫(xiě)的
?GroupInfoControl groupcontrol = new GroupInfoControl(group, !group.Id.Equals(Guid.Empty), false);
其實(shí)我是這樣寫(xiě)的
private void GroupBtnDel_Click(object sender, RoutedEventArgs e)
?{
??????????? if (MessageBox.Show("確認(rèn)要?jiǎng)h除分組: " + GetSelectGroup().Name + " ?", "", MessageBox?Button.OKCancel).Equals(MessageBoxResult.OK))??
????????????????????client.DeleteGroupAsync(UserID, GetSelectGroup().Id.ToString());
}
其實(shí)我是這樣寫(xiě)的
??????? void groupEditWindow_Closed(object sender, EventArgs e)
??????? {
??????????? ?? if (((GroupEditChildWindow)sender).DialogResult ?? true)?? Refresh();
??????? }
其實(shí)我是這樣寫(xiě)的
???????? 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;
??????? }
其實(shí)我是這樣寫(xiě)的
??????? public HRInfo GetHRbyID(string userid, string hrID)
??????? {
??????????? ?return LoadUser(userid).IsOK ? new HRInfo(uBL.GetHRByKey(new Guid(hrID))) : null;
??????? }?
其實(shí)我是這樣寫(xiě)的
??????? private List<GhostTreeViewItem> GetAllRoot()
??????? {
??????????? return (from p in DataList where p.Parentid ==null select p).ToList();
??????? }
也許我該這樣寫(xiě)
?????????? string result;
??????????? if (str == null)
??????????? {
??????????????? result = "";
??????????? }
??????????? else
??????????? {
??????????????? if (str.Length > length)
??????????????? {
??????????????????? result = str.Substring(0, length);
??????????????????? result = result + "..";
??????????????? }
??????????????? else
??????????????? {
??????????????????? result = str;
??????????????? }
??????????? }
??????????? return result;
其實(shí)我是這樣寫(xiě)的
?????????return str == null ? "" : (str.Length > length ? str.Substring(0, length) + ".." : str);
?????未完待續(xù)。。。。。?
轉(zhuǎn)載于:https://www.cnblogs.com/GhostZCH/archive/2011/08/02/2125604.html
總結(jié)
以上是生活随笔為你收集整理的发现自己的代码写的越来越玄幻了的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 浅谈SQL性能优化
- 下一篇: 不装oracle进行远程连接解决办法 .