protected Int32 Sum(int one, int two)
{
int result;
int tmp;
tmp = one + two;
result = tmp;
return result;
}
Jesus.
public bool IsTrue(bool value) {
return value.ToString().length() == 4;
}
return IsActive == true ? true : false;
string str = Console.ReadLine();
string len = 0;
for(int i = 0; i < str.Length; i++)
{
len++;
}
Let's get string length :| Dummy
string random = "1";
//this is a commit!!
trans.Commit();
It doesn't look like it was there because of some changes - someone simply wanted to be double sure he will see the commit there, I guess..
if(products.Length < 0) {
foreach (var p in products)
{
//...
}
}
Console.WriteLine("|"+ Espace(x-1) + (h==3?" o":""));
Console.WriteLine("|"+ Espace(x-1) + (h==2?" o":(h==3?"/|\\":"")));
Console.WriteLine("|"+ Espace(x-1) + (h==1?" o":(h==2?"/|\\":(h==3?" |":""))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?" o":(h==1?"/|\\":(h==2?" |":(h==3?"/ \\":"")))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?"/|\\":(h==1?" |":(h==2?"/ \\":""))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?" |":(h==1?"/ \\":"")));
Console.WriteLine("|"+ Espace(x-1) + (h==0?"/ \\" : ""));
bool b = connection.isConnected() == true ? true : false;
My first internship presented me with this.
public void Method1(Enum foo)
{
if (GetCondition1(foo))
{
doSomething();
}
}
private bool GetCondition1(Enum foo)
{
if (foo == Enum.Value1)
return true;
return false;
}
protected void EnableEditButtons(bool Value)
{
if (Value == false)
{
buttonAdd.Disabled = true;
buttonDelete.Disabled = true;
}
else
{
buttonAdd.Disabled = false;
buttonDelete.Disabled = false;
}
}
// ...
if (IsEditable(ID))
EnableEditButtons(true);
else
EnableEditButtons(false);
I found this old code in an app I was updating for a client a number of years back. It was so good I documented it on my own blog.
public enum YesNoEnum
{
Yes = 0,
No = 1
}
I also like how they defined the enum values.
public static bool HasValues<T>(this ICollection<T> collection)
{
if (collection == null)
{
return false;
}
if (collection.Count == 0)
{
return false;
}
return true;
}
if ( x == true)
{
// do something
}
Fucking amateurs :| lol
public void Handle(SomethingCreatedEvent e)
{
if (e.ActCode == "SOME_VALUE")
{
return;
}
else
{
// insert real function body here
}
}