1. C# / Говнокод #12446

    +139

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    List<string> duplicities = new List<string>();
    
          foreach (var localItem in FileCollectionLocal)
          {
            foreach (var remoteItem in FileCollectionRemote)
            {
              if (localItem.FileName == remoteItem.FileName)
              {
                duplicities.Add(localItem.FileName);
              }
            }
          }

    taburetka, 18 Января 2013

    Комментарии (10)
  2. C# / Говнокод #12433

    +116

    1. 1
    2. 2
    public const string Checked = "☑";
    public const string Unchecked = "☐";

    Чекбокс

    roman-kashitsyn, 16 Января 2013

    Комментарии (34)
  3. C# / Говнокод #12409

    +127

    1. 1
    mainChartArea.Area3DStyle.Enable3D = (ShowIn3D.Checked) ? true : false;

    Если true - значит true)))

    tvv, 11 Января 2013

    Комментарии (7)
  4. C# / Говнокод #12384

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public override int GetHashCode()
        {
          if (this.FileName == null)
          {
            return base.GetHashCode();
          }
    
          return this.FileName.GetHashCode() + 13;
        }

    почему 13?

    taburetka, 02 Января 2013

    Комментарии (31)
  5. C# / Говнокод #12365

    +134

    1. 1
    int y = (int)Math.Floor((decimal)(block_number / w));

    все переменные - int

    akai_mirror, 26 Декабря 2012

    Комментарии (5)
  6. C# / Говнокод #12363

    +114

    1. 1
    2. 2
    // FxCop does not allow the string "Uri" in a method name that does not return a Uri object.
        public static string To_U_r_i_TypeString(DeviceType type)

    dirtygopher, 26 Декабря 2012

    Комментарии (96)
  7. C# / Говнокод #12321

    +132

    1. 1
    public virtual int ReadByte()

    Тут в соседнем треде появилась такая тема:

    http://msdn.microsoft.com/ru-ru/library/system.io.stream.readbyte.aspx
    http://govnokod.ru/12311#comment164854

    LispGovno, 20 Декабря 2012

    Комментарии (59)
  8. C# / Говнокод #12320

    +135

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    public static string GetCommandLineParameter(string ParameterName)
        {
          ParameterName = ParameterName.ToLower();
          string ParameterIdentifikator = ParameterName.ToLower() + "=";
          
          string RetVal = null;
          foreach(string Arg in Environment.GetCommandLineArgs())
          {
            string ArgLower = Arg.ToLower();
            if(ArgLower.IndexOf(ParameterIdentifikator) == 0)
            {
              RetVal = Arg.Substring(ParameterIdentifikator.Length, Arg.Length - ParameterIdentifikator.Length);
              return RetVal;
            }
          }
          return RetVal;
        }

    читаем параметры из командной строки

    taburetka, 19 Декабря 2012

    Комментарии (13)
  9. C# / Говнокод #12313

    +115

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    public bool checkUser(UserModel model = null)
    {
    	check:
    	if(model != null)
    		if(model.authenticated != false)
    			if(model._id > 0)
    				return true;
    			else
    				goto check;
    		else
    			goto check;
    	else
    		goto check;
    	return false;
    }

    а вдруг?!

    d3n4, 19 Декабря 2012

    Комментарии (20)
  10. C# / Говнокод #12274

    +102

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    /// <summary>
    /// Проверка пароля *
    /// </summary>
    private string CheckPassword(String _password)
    {
        int kol = 0;
        const int LEN = 32;
        if (_password.Length == LEN)
            return _password;
        else
        {
            StringBuilder _pass = new StringBuilder(_password, LEN);
            if (_password.Length > LEN)
            {
                kol = _password.Length - LEN;
                return (_password.Substring(0, _password.Length - kol));
            }
            else
            {
                kol = LEN - _password.Length;
                int i = 0;
                while (i != kol)
                {
                    _pass.Append(" ");
                    i++;
                }
            }
            return _pass.ToString();
        }
    }

    Crazzy, 12 Декабря 2012

    Комментарии (12)