I have been reviewing the code of a new co-worker and, although in general I think it's OK, there's a thing that causes me mixed feelings:  private void Method(...)  {       Thread t = new Thread(() =>       {           // Some ~50 lines of code here       });       t.Start();  }This is no big deal, but I'm curious about what you guys think of it.Is this exactly what lambdas are for? Or just the opposite? I try to avoid any lambda which doesn't fit on a couple lines at most...
Long function as a lambda, right or wrong?
c#;lambda
In my opinion no preferable answer can be given without seeing the exact code. I don't like splitting code into smaller methods just for the sake of making methods smaller, as opposed to Brian Reichle's answer (and many other people that follow this approach).If the code of the thread is and can only be used locally, I would leave it in there regardless of the LOC. Using a lambda has the advantage that you don't 'pollute' your class with an extra private method which is only called from one location. This provides for better encapsulation, which is a core principle of OO which makes it shine.If the code of the thread were to be reuseable, I would rather think about splitting the behavior in a separate class than in a separate method, unless the code only makes sense in the original class.Also as a sidenote; I realize you probably just named your code as to get the idea across, but I'd make sure the name of Method would indicate it only starts a certain action, but doesn't finish it. E.g. StartSomeMethod.