Fórmulas e Cenas

Object Reference Not Set to Instance of an Object

  Home  |   Contact  |   Syndication    |   Login
  39 Posts | 0 Stories | 6 Comments | 0 Trackbacks

News

Archives

Post Categories

Links

Fun

Well... I cant really express my feelings for this kind of programming... The WTF way: DateTime myNewDate = DateTime.Parse((myOldDate.Year - 1).ToString() + "-" + myOldDate.Month.ToString() + "-" + myOldDate.Day.ToString()); The right way: DateTime myNewDate = myOldDate.Date.AddYears(-1);
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Well, this one i simply cannot understand... why anyone would do +0 after and int.parse. Any Ideas? int myVar = Int32.Parse(ConfigurationMa... + "") + 0;
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Sometimes we find some code that... well.... I guess someone must be really REALLY high to write... The WTF way DateTime.Parse(DateTime.Now... The right way: DateTime.Now.ToString("dd-M
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

In this category I will post some "creative" solutions to problems. (Code changed to protect the inocents). // The WTF way int myInt = Int32.Parse(myDataTable.Row... + ""); // The correct way int myInt = myDataTable.Rows.Count;
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati