- 1
 - 2
 - 3
 - 4
 - 5
 - 6
 
if (ctrl.GetType().Name == "TextBox")
{
       TextBox tb = (TextBox)ctrl;
     // остальное вырезано
}
                                    Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+112.2
if (ctrl.GetType().Name == "TextBox")
{
       TextBox tb = (TextBox)ctrl;
     // остальное вырезано
}
                                    Я даже комментить не могу это.
+144.2
if ( strlen(f.ToString()) < 5 )
                                    Проверку булевской переменной.
+99.4
string date_format = DateTime.Now.ToString("dddd dd") + "th " + DateTime.Now.ToString("MMMM yyyy");
if (DateTime.Now.Day == 1 || DateTime.Now.Day == 21 || DateTime.Now.Day == 31) date_format = DateTime.Now.ToString("dddd dd")+"st "+DateTime.Now.ToString("MMMM yyyy");
else if (DateTime.Now.Day == 2 || DateTime.Now.Day == 22) date_format = DateTime.Now.ToString("dddd dd")+"nd "+DateTime.Now.ToString("MMMM yyyy");
            else if (DateTime.Now.Day == 3 || DateTime.Now.Day == 23) date_format = DateTime.Now.ToString("dddd dd")+"rd "+DateTime.Now.ToString("MMMM yyyy");
                                    DateTime formatting - don't try this at home!
+92.8
name[0].InnerText = Regex.Replace(name[0].InnerText, @"<[^>]+>", string.Empty);
name[0].InnerText = Regex.Replace(name[0].InnerText, "a*[a-z]*A*[A-Z]*", string.Empty);
name[0].InnerText = Regex.Replace(name[0].InnerText, ",", string.Empty);
name[0].InnerText = Regex.Replace(name[0].InnerText, "\\.", string.Empty);
name[0].InnerText = Regex.Replace(name[0].InnerText, ";", string.Empty);
name[0].InnerText = Regex.Replace(name[0].InnerText, "&", string.Empty);
name[0].InnerText = Regex.Replace(name[0].InnerText, "\\?", string.Empty); 
name[0].InnerText = Regex.Replace(name[0].InnerText, "\n", string.Empty);
name[0].InnerText = Regex.Replace(name[0].InnerText, " ", string.Empty);
                                    такие дела. кстати, как улучшить? :)) Нужно, чтобы обрезалось все, кроме чисел (положительных и отрицательных) Я какбе начинающий
+943.7
static string ConCat(string str0,string str1)
        {
            if (str0 is string && str1 is string) return str0 + str1;
            else return null;
        }
                                    А вдруг НЕ строку подсунут....
+105.2
public static bool EqualHash(string x, string y)
        {
            if ((x == null || y == null) && x != y)
                return false;
            if (x == null && x == y)
                return true;
            
            if (x.Length != y.Length)
                return false;
            
            for (int i=0; i<x.Length; i++)
            {
                if (x[i] == y[i])
                    return false;
            }
            return true;
        }
//чуть ниже в том же классе
        public static bool SimpleEqualHash(string x, string y)
        {
            return (x == y);
        }
                                    
+134.5
static void Main(string[] args)
        {
            if (args.Length < 1)
                Console.WriteLine("Usage:\n\tprogram <Folder> [output file]");
            else if (args.Length == 1)
            {
                string outf = args[0] + "\\output.txt";
                System.IO.File.WriteAllLines
                    (
                        outf,
                        new List<string>
                            (
                                System.IO.Directory.GetFiles(args[0])
                            )
                                .Concat(System.IO.Directory.GetDirectories(args[0]))
                                .ToArray()
                    );
            }
            else if(args.Length == 2)
            {
                string outf = args[1];
                System.IO.File.WriteAllLines
                    (
                        outf,
                        new List<string>
                            (
                                System.IO.Directory.GetFiles(args[0])
                            )
                                .Concat(System.IO.Directory.GetDirectories(args[0]))
                                .ToArray()
                    );
            }
        }
                                    Видите ли, я не знал как это сделать с помощью скриптовых языков виндовс.
+950.3
//...
for (int i = 0; i < arr.Length; i++)
{
      if (i == 5)
      {
             if (arr[i] == -1)
             {
                    break;
             }
             else
             {
                    return -1;
             }
      }
      else continue;
}
//...
                                    
+131.4
internal static System.Drawing.Font ToWindowsFont(Microsoft.Office.Interop.PowerPoint.Font ppFont)
{
	FontStyle style = ToGdiFontStyle(ppFont.Style);
	System.Drawing.Font gdiFont = new System.Drawing.Font(ppFont.Name, ppFont.Size, style);
	// из-за следующей строчки проект не скомпилируется под .NET 2.0, требуя ещё и один из более новых SP
	if ( windowsFont.Name != windowsFont.OriginalFontName )
	{
		windowsFont = new System.Drawing.Font(TextConverter.DefaultUnicodeSubstituteFont, ppFont.Size, style);
	}
	return windowsFont;
}
                                    Баг был случайно найден на виртуалке с чистой Windows XP и MS Visual Studio 2005, поскольку мы по собственной глупости упустили тот факт, что на хост-машинах давно стоит .NET 3.5. Строчка "if ( windowsFont.Name != ppFont.Name )" решает проблему совместимости. Вот как иногда из-за маленькой, не бросающейся в глаза, ошибки можно завалить весь проект. Каюсь, этот код - мой. ))
+132.4
var ChildListWithCondition =
                (from list in ChildList
                 join requestedRelatedEntityIds in EntitiesIdInList on list.ParentEntityId equals requestedRelatedEntityIds
                 join requestedEntityType in EntityTypeIdToTake on list.EntityTypeId equals requestedEntityType)
                 .Select(list => 
                     new LayoutDataOutputStructure()
                     {
                         ParentEntityId = list.ParentEntityId,
                         EntityId = list.EntityId,
                         FieldId = list.FieldId,
                         FieldValue = list.FieldValue,
                         EntityTypeId = list.EntityTypeId,
                         RelationTypeToParent = list.RelationTypeToParent,
                         FieldValueId = list.FieldValueId
                     })
                .GroupBy(item => item.ParentEntityId)
                .Select(group => new
                    {
                        ParentEntityId = group.Key,
                        GroupEntityTypeId = group.GroupBy(item => item.EntityTypeId)
                            .Select(group2 => new
                                                 {
                                                    EntityTypeId = group2.Key,
                                                    EntityRelation = group2.Select(item => item.RelationTypeToParent).FirstOrDefault(),
                                                    GroupEntityId = group2.GroupBy(group3 => group3.EntityId)
                                                        .Select(group3 => new
                                                                              {
                                                                                  EntityId = group3.Key, 
                                                                                  Fields = group3.GroupBy(group4 => group4.FieldId)
                                                                                    .Select(group4 => new { FieldId = group4.Key, FieldValues = group4 })
                                                                                    
                                                                              })
                                                 }
                                )
                    }
                )
                .ToList();