2

I like efficient coding and want to know if checking variable and setting is more efficient or just setting it. Code bellow is written in C# NET:

private bool MMoving;

protected override void OnMouseDown(MouseEventArgs e)
{
    MMoving = true;
}

Code structure is like: if MMoving is true then move control by cursor position. Question is, will there be more efficient to check if MMoving is already true & set it if it is not or just set it to true (Or this depends on amount of calling or on CPU/RAM).

Name
  • 21
  • 2

0 Answers0