2

My coding standards plugin is complaining and telling me to use a lambda for this delegate but the only suggested fix is to ignore the warning, how do I go about this?

myobb.Populate += delegate(string s1, string s2)
{
    string s3 = s1 + s2;
    SomeObject.DoSomething(s3);
};
2
  • 1
    You are not using the s3 variable you declared. The anonymous function does nothing currently. Commented Aug 6, 2019 at 4:35
  • This was a shorthand example of what I'm actually trying to do, the inner workings of the delegate work fine as it stands, I just want to convert it to a lambda. Commented Aug 6, 2019 at 4:36

1 Answer 1

4

Like so:

myobb.Populate += (string s1, string s2) =>
{

};

or simpler:

myobb.Populate += (s1, s2) =>
{

};
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you kind sir, that's all I needed :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.