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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    /// <summary>
            /// Returns current UTC time
            /// </summary>
            /// <returns></returns>
            public static DateTime GetCurrentTimeUtc()
            {
                DateTime dt = DateTime.UtcNow;
                return dt;
            }

    Индус-стайл метод

    sem13, 17 Августа 2010

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

    +142

    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
    void InitializeComponent()
            {
                ResizeRedraw = true;
                this.Paint += new PaintEventHandler(Do);
            }
    
            void Do(object sender, PaintEventArgs e)
            {
                object[] ob = { e.Graphics };
                new Thread(Update).Start(ob);
            }
    
            void Update(Graphics e)
            {
                PointF[] pp = new PointF[this.Width];
    
                for (int i = 0; i < this.Width; i++)
                {
                    pp[i].X = i;
                    pp[i].Y = this.Height / 2;
                }
    
                e.DrawCurve(new Pen(Color.Black, 3), pp);
            }

    sergylens, 16 Августа 2010

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

    +113

    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
    double x, y;
    
    void InitializeComponent()
    {
        this.MouseClick += new MouseEventHandler(Form1_Click);
        this.Paint += new PaintEventHandler(Form1_Paint);
    }
    
    void Form1_Paint(object sender, PaintEventArgs e)
    {
        PointF p = new PointF(0, 0);
        PointF pp = new PointF((float)x, (float)y);
        e.Graphics.DrawPolygon(new Pen(Color.Black, 3), new PointF[2] { p, pp });
    }
    
    void Form1_Click(object sender, MouseEventArgs e)
    {
        x = e.X;
        y = e.Y;
    
        AsyncDraw(ref x, ref y);
    }
    
    void AsyncDraw(ref double x, ref double y)
    {
        x = x;
        y = y;
    }

    sergylens, 14 Августа 2010

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

    +143

    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
    void Draw(object sender, PaintEventArgs e)
            {
                e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
    
                //X
                e.Graphics.DrawLine(new Pen(Color.Blue, 3), new Point(0, this.Height / 2), new Point(this.Width, this.Height / 2));
    
                //Y
                e.Graphics.DrawLine(new Pen(Color.Red, 3), new Point(this.Width / 2, this.Height), new Point(this.Width / 2, 0));
    
    
                PointF[] p = new PointF[this.Width];
    
                //MessageBox.Show((Math.PI / 180 * 1).ToString());
                for(int i = 0, z = this.Width; i < (this.Height / 2); i++, z++)
                {
                    p[i].X = (float)Math.Cos(z) * this.Width;
                    p[i].Y = (float)Math.Sin(i) * this.Height;
                }
    
                e.Graphics.DrawCurve(new Pen(Color.LightSkyBlue, 2), p, 2);
            }

    sergylens, 13 Августа 2010

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

    +112

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    //Floating
    float k = 0.0001f;
    for (float i = 10.9f; i >= -10.9f; i--)
    {
        i += +1 - k;
        e.Graphics.DrawEllipse(new Pen(Color.Green, 5), 15 * (float)Math.Sin(i), 15 * i, 5, 5);
    }

    Учусь рисовать окружность

    sergylens, 11 Августа 2010

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

    +113

    1. 1
    2. 2
    3. 3
    Guid RespondentId = Guid.NewGuid();
    
    if (RespondentId != Guid.Empty)

    ReFlexOn, 11 Августа 2010

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

    +144

    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
    static void Main(string[] args)
            {
                int[,] mas = new int[5, 5];
                Random rnd = new Random();
                for (int i = 0; i < 5; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        mas[i, j] = rnd.Next(0, 100);
                        Console.Write(mas[i, j] + "\t");
                    }
                    Console.WriteLine();
                }
            }

    Ebaw, 10 Августа 2010

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

    +111

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    string filename = "pasker_ltd.xls";
                         string ConnectionString = String.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}; Extended Properties=Excel 8.0;", filename);
                DataSet ds = new DataSet("EXCEL");
                OleDbConnection cn = new OleDbConnection(ConnectionString);
                cn.Open();
                DataTable schemaTable =cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[] { null, null, null, "TABLE" });
                string sheet1 = (string)schemaTable.Rows[0].ItemArray[2];
                string select = String.Format("SELECT * FROM [{0}]", sheet1);
                OleDbDataAdapter ad = new OleDbDataAdapter(select, cn);
                ad.Fill(ds);
                DataTable tb = ds.Tables[0];
                dataGridView1.DataSource = tb;

    Ebaw, 10 Августа 2010

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

    +104

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    int x = 1, z = ++x + x;
    Console.WriteLine (x.ToString () + "  " + z.ToString ());
    x = 1;
    int z1 = x + ++x;
    Console.WriteLine (x.ToString ()  + "  " + z1.ToString ());

    Вот такой код

    Ebaw, 10 Августа 2010

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

    +117

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    using System;
    class PleaseSayUra
    {
    static void WriteHelloSam()
    {
    Console.WriteLine("Hellosam");
    WriteHelloSam();
    }
    }

    >>Пытаюсь вызвать метод, а программа пишет ошибка "Не содержит статического метода "Main", подходящего для точки входа ConsoleApplication1" Рассажите что такое?
    http://otvet.mail.ru/question/43958756/

    This is obvious, 10 Августа 2010

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