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

    +139

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (sdk.Name.ToLower().Contains("Windows Phone"))
                    {
                        WP7SDK = sdk;
                        break;
                    }

    Быстро написал, потом когда пересматривал обнаружил

    BelorusBY, 28 Октября 2011

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

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?xml version="1.0"?>
    -<DocumentElement> 
    	<o2p time="27.10.2011 8:00:38"/>
    	<o2p timecreate="26.10.2011 22:43:17"/> 
    	<o2p di="0.0000" g="" d="" dv="0.0000" i="8751" q="4.0000" c="C3212"/> 
    	<o2p di="0.0000" g="" d="" dv="0.0000" i="8751" q="2.0000" c="C3213"/>
    ...

    после обновления ПО в файлах выгрузки добавились строки 3-4

    nk112, 27 Октября 2011

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

    +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
    static void Main(string[] args)
    {
        string[] indiaCityVisit = {
            "Delhi", "Jodhpur", "Mumbai", "Pune",  "Agra",
            "Shimla", "Bengaluru", "Mysore", "Ooty",
            "Jaipur", "Nagpur", "Amritsar", "Hyderabad",
            "Goa", "Ahmedabad" };
    
        string cities = String.Join(",", indiaCityVisit
                              .Select(s => s.ToString())
                              .ToArray());
        Console.WriteLine(cities);      
       
        Console.ReadLine();
    }

    http://www.devcurry.com/2010/12/convert-string-array-into-string-c-linq.html
    Индусы такие индусы

    roman-kashitsyn, 27 Октября 2011

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

    +124

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    private bool IsDigit(char c)
            {
                if (digitInIndicatorList.Contains(c))
                {
                    return true;
                }
                return false;
            }
    
    readonly static List<char> digitInIndicatorList = new List<char>() { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };

    Неустаревающая классика...

    fr0mrus, 27 Октября 2011

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

    +118

    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
    if (true)
                {
    
                    full_result_list = this.FullTextSearch(list_without_uss, this.CountOfDocs);
                    foreach (SearchResultItem add_item in full_result_list)
                    {
                        SearchResultItem find_item = (SearchResultItem)result_list.Find(it => ((it.DocId == add_item.DocId) && (it.ModId == add_item.ModId)));
                        if (find_item != null)
                        {
                            //                                                    find_item.Relev += add_item.Relev;
                        }
                        else
                        {
                            result_list.Add(add_item);
                        }
                    }
                }

    Просто фейерично!

    f5f3e9, 26 Октября 2011

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

    +128

    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 class BusinessUnitDetail
    {
        public string Description { get; set; }
    }
    
    ...
    
    [TestMethod]
    public void DescriptionTest()
    {
        BusinessUnitDetail target = new BusinessUnitDetail(); 
        string expected = "test test test\n test"; 
        string actual;
        target.Description = expected;
        actual = target.Description;
        Assert.AreEqual(expected, actual);
    }

    беспощадная проверка всего и вся

    Eugene, 25 Октября 2011

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

    +116

    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
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    <Grid Grid.Row="2" Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <ContentPresenter Grid.Row="0" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[0]}"/>
                <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[1]}"/>
                <ContentPresenter Grid.Row="0" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[2]}"/>
                <ContentPresenter Grid.Row="1" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[3]}"/>
                <ContentPresenter Grid.Row="1" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[4]}"/>
                <ContentPresenter Grid.Row="1" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[5]}"/>
                <ContentPresenter Grid.Row="2" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[6]}"/>
                <ContentPresenter Grid.Row="2" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[7]}"/>
                <ContentPresenter Grid.Row="2" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[8]}"/>
                <ContentPresenter Grid.Row="3" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[9]}"/>
                <ContentPresenter Grid.Row="3" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[10]}"/>
                <ContentPresenter Grid.Row="3" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[11]}"/>
                <ContentPresenter Grid.Row="4" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[12]}"/>
                <ContentPresenter Grid.Row="4" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[13]}"/>
                <ContentPresenter Grid.Row="4" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[14]}"/>
                <ContentPresenter Grid.Row="5" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[15]}"/>
                <ContentPresenter Grid.Row="5" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[16]}"/>
                <ContentPresenter Grid.Row="5" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[17]}"/>
                <ContentPresenter Grid.Row="6" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[18]}"/>
                <ContentPresenter Grid.Row="6" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[19]}"/>
                <ContentPresenter Grid.Row="6" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[20]}"/>            
            </Grid>

    legat, 22 Октября 2011

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

    +118

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (mainWareHouseId.HasValue && mainWareHouseId.Value.ToString() == this._locationList.SelectedValue)
    {
        return false;
    }
    else
    {
        return location == null ? true : !location.RegionalFulfillment;
    }

    abatishchev, 21 Октября 2011

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

    +952

    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
    31. 31
    32. 32
    namespace AppendStrinAtBegin
    {
        class Program
        {
            static void ProcessDirectory(string path, string fileMask, Action<string> action)
            {
                Directory.EnumerateFiles(path, fileMask).ToList().ForEach(action);
                Directory.EnumerateDirectories(path).ToList().ForEach
                    (
                        subDirectory => ProcessDirectory(subDirectory, fileMask, action)
                    );
            }
    
            static void Main(string[] args)
            {
                Console.WriteLine("Path FileMask AppendedString");
                if (args.Length < 3)
                    return;
                var appendedString = args.Skip(2).Aggregate((workingSentence, next) => workingSentence+ " " +next);
                ProcessDirectory(args[0], args[1], (file) => ProcessFile(file, appendedString));
                Console.WriteLine("Gun done");
            }
    
            static void ProcessFile(string file, string appendedStringAtBegin)
            {
                var fileLines = File.ReadAllLines(file, Encoding.GetEncoding(1251));
                var fileResulted = fileLines.ToList();
                fileResulted.Insert(0, appendedStringAtBegin);
                File.WriteAllLines(file, fileResulted, Encoding.GetEncoding(1251));
            }
        }
    }

    ohlol, 18 Октября 2011

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

    +122

    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
    for (int y = 0; y < bmp.Height; y++)
            {
                for (int x = 0; x < bmp.Width; x++)
                {
                    Color col = bmp.GetPixel(x, y);
                    col = Color.FromArgb((col.R + col.G + col.B) / 3,
                        (col.R + col.G + col.B) / 3,
                        (col.R + col.G + col.B) / 3);
                    int rValue = int.Parse(col.R.ToString());
                    html.Append(getGrayShade(rValue));
                    if (x == bmp.Width - 1)
                        html.Append("<br/&rt");
                }
            }

    Нашел проект на codeproject, для конвертации изображения в аscii-art

    psina-from-ua, 18 Октября 2011

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