2008/10/18

字串比對上的眉角



if (e.Row.Cell[0].Text.Equals("mytest"))

...

改成



if ("mytest".Equals(e.Row.Cell[0].Text))

...

可避免因為e.Row.Cell[0].Text如果是空值而造成程式exception.

軟體工程的重要的指標