string date = user.RegistrationDate.ToShortDateString().ToString();
private void reset_kolejnosc()
{
this.kolejnosc_s[0] = 1;
this.kolejnosc_s[1] = 2;
this.kolejnosc_s[2] = 3;
this.kolejnosc_s[3] = 4;
this.kolejnosc_s[4] = 5;
this.kolejnosc_s[5] = 6;
this.kolejnosc_s[6] = 7;
this.kolejnosc_s[7] = 8;
this.kolejnosc_s[8] = 9;
this.kolejnosc_s[9] = 10;
}
if ((bool)greenButton.IsChecked)
{
CurrentColor = Color.FromArgb(0xFF, 0x00, 0xCC, 0x00);
}
else if ((bool)greyButton.IsChecked)
{
CurrentColor = Color.FromArgb(0xFF, 0x79, 0x79, 0x79);
}
foreach (var item in ItemsList.Items)
{
if ((grid.Background as SolidColorBrush).Color == CurrentColor)
{
selectedItems.Add(item);
}
}
public event EventHandler<Cles_graph_doivent_etre_redessines> les_graph_doivent_etre_redessines;
public void remove_event()
{
if (this.les_graph_doivent_etre_redessines != null)
{
foreach (EventHandler<Cles_graph_doivent_etre_redessines> F_les_graph_doivent_etre_redessines in this.les_graph_doivent_etre_redessines.GetInvocationList())
{
this.les_graph_doivent_etre_redessines -= F_les_graph_doivent_etre_redessines;
}
}
}
[HttpPost]
[Route("validaPrepacks")]
public IHttpActionResult ValidaPrepacks(ValidaPrepackVO validacion)
{
try
{
return Ok();
}
catch (Exception e)
{
return Ok(e.Message);
}
}
A code that "validate" a pack in the backend
/// <summary>
/// Desctop constructor
/// </summary>
...
This is best XML commentary I found so far.
var doc = (Parent as Doc);
doc.Name = (doc != null) ? "" : doc.Name
i++;
i++;
i++;
i++;
Console.WriteLine(i);
He doesn't know what is " i+=4 " :||||
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
}
}
public static bool HasValues<T>(this ICollection<T> collection)
{
if (collection == null)
{
return false;
}
if (collection.Count == 0)
{
return false;
}
return true;
}
public enum YesNoEnum
{
Yes = 0,
No = 1
}
I also like how they defined the enum values.
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.
bool b = connection.isConnected() == true ? true : false;
My first internship presented me with this.