|
Παρουσίαση με Ετικέτες
Όλες οι Ετικέτε... » Anti-Patterns (RSS)
-
I've had a genuine TheDailyWTF moment earlier today, when I found the C# equivalent of this VB6 code that returns a three letter month name:DateTime time = DateTime.Now;
string foldername = time.Year.ToString() + ''_'' + GetMonthName(time.Month);
private static string GetMonthName(int month)
{
switch (month)
{
case ...
-
From the same legacy code as this post comes this code that loads a combo box with ListItems and then removes unwanted items in a way that is guaranteed to cause an exception when the indexer reaches the middle of the list, which now has only half the initial items:ddlItems.Items.Clear();
// Re-load so we can filter the ...
-
Almost all Sharepoint developers know that you should dispose SPSite and SPWeb object you create in code. Doing so is not hard, you just enclose your objects in a using statement. I found the following piece of code in dozens of places in some legacy Sharepoint code created by people who should have known better:SPSite site = null;
SPWeb web = ...
|
|
|