- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
public void TrimExcess()
{
int num;
num = (int) (((double) ((int) this._items.Length)) * 0.9);
if (this._size >= num)
{
goto Label_002A;
}
this.Capacity = this._size;
Label_002A:
return;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+5
public void TrimExcess()
{
int num;
num = (int) (((double) ((int) this._items.Length)) * 0.9);
if (this._size >= num)
{
goto Label_002A;
}
this.Capacity = this._size;
Label_002A:
return;
}
Хуброхапр
+2
while (s != null)
{
s = fs.ReadLine();
//arr line example <rect x="0" y="0" rgba(92,41,235,0.9921568627451
String[] arr = s.Split('(');
arr = arr[1].Split(',');
int fourPart = (int)(float.Parse(arr[3].Replace('.',',')) * 0xFF);
var binaryFour = Convert.ToString(fourPart, 2);
while(binaryFour.Length < 8)
{
binaryFour = "0" + binaryFour;
}
int threePart = int.Parse(arr[2]);
var binaryThree = Convert.ToString(threePart, 2);
while (binaryThree.Length < 8)
{
binaryThree = "0" + binaryThree;
}
int twoPart = int.Parse(arr[1]);
var binaryTwo = Convert.ToString(twoPart, 2);
while (binaryTwo.Length < 8)
{
binaryTwo = "0" + binaryTwo;
}
int firstPart = int.Parse(arr[0]);
var binaryfirst = Convert.ToString(firstPart, 2);
number = Convert.ToInt32((binaryfirst + binaryTwo + binaryThree + binaryFour),2);
Write("number", number.ToString());
}
Хз как такое вообще появляется в голове
+5
https://github.com/KvanTTT/Cool-Compiler/blob/master/CoolCompiler/CoolCompiler.cs
Учитесь, сопляки, как исключения перехватывать!
+2
using System;
using System.Collections.Generic;
using System.Linq;
namespace Lens.Stdlib
{
/// <summary>
/// Standard library randomizer methods.
/// </summary>
public static class Randomizer
{
#region Fields
/// <summary>
/// Random seed.
/// </summary>
public static readonly Random m_Random = new Random();
#endregion
#region Methods
/// <summary>
/// Gets a random floating point value between 0.0 and 1.0.
/// </summary>
/// <returns></returns>
public static double Random()
{
return m_Random.NextDouble();
}
/// <summary>
/// Gets a random integer value between 0 and MAX.
/// </summary>
public static int Random(int max)
{
return m_Random.Next(max);
}
/// <summary>
/// Gets a random integer value between MIN and MAX.
/// </summary>
public static int Random(int min, int max)
{
return m_Random.Next(min, max);
}
/// <summary>
/// Gets a random element from the list.
/// </summary>
public static T Random<T>(IList<T> src)
{
var max = src.Count - 1;
return src[Random(max)];
}
/// <summary>
/// Gets a random element from the list using a weighter function.
/// </summary>
public static T Random<T>(IList<T> src, Func<T, double> weighter)
{
var rnd = m_Random.NextDouble();
var weight = src.Sum(weighter);
if (weight < 0.000001)
throw new ArgumentException("src");
var delta = 1.0/weight;
var prob = 0.0;
foreach (var curr in src)
{
prob += weighter(curr) * delta;
if (rnd <= prob)
return curr;
}
throw new ArgumentException("src");
}
#endregion
}
}
Ну что сказать, 3,4-Метилендиоксиамфетамин
+6
https://github.com/pascalabcnet/pascalabcnet
ШОК! Говном компилируется говно. Это рекорд
+4
public class tcMoveDirection
{
public enum tcDirection { R, L, N };
static public tcDirection fromstring(string expression)
{
switch (expression)
{
case "R":
return tcDirection.R;
case "L":
return tcDirection.L;
case "N":
return tcDirection.N;
default: throw new InvalidCastException();
}
}
}
+6
if (selectedGroup == null)
return null;
return selectedGroup;
зачем if то?
0
using Microsoft.VisualBasic.CompilerServices;
using System;
namespace ConsoleApplication2
{
[StandardModule]
internal sealed class Module1
{
[STAThread]
public static void Main()
{
label_0:
int num1;
int num2;
try
{
ProjectData.ClearProjectError();
num1 = 1;
label_1:
int num3 = 2;
Test.TTT();
goto label_8;
label_3:
num2 = num3;
switch (num1)
{
case 1:
int num4 = num2 + 1;
num2 = 0;
switch (num4)
{
case 1:
goto label_0;
case 2:
goto label_1;
case 3:
case 4:
goto label_8;
}
}
}
catch (Exception ex) when (ex is Exception & (uint) num1 > 0U & num2 == 0)
{
ProjectData.SetProjectError(ex);
goto label_3;
}
throw ProjectData.CreateProjectError(-2146828237);
label_8:
if (num2 == 0)
return;
ProjectData.ClearProjectError();
}
}
}
Вот какая жуть получилась при декомпиляции старого доброго On Error Resume Next из VB.
Исходный код:
Sub Main()
On Error Resume Next
TTT() 'определен в модуле Test
Exit Sub
End Sub
0
var languageCodes = locales
.GroupBy(l => l.Key.Substring(0, 2))
.Select(group => group.First())
.Select(l => new KeyValuePair<string, string>(l.Key.Substring(0, 2), l.Value))
.OrderBy(l => l.Value);
Прислала боевая подруга из Канады. Да, это продакшен. Но на этот раз код не падавана, а её собственный.
+5
private void sendCommand(Hi1Command command)
{
var aCommand = command as Hi1Command;
...
}
На случай если Microsoft откажется от строгой типизации С#