Is there a workaround to update a ref parameter inside an anonymous method?
I know that the an anonymous method doesn't allow access to ref parameters of the outer scope, but is there another way to do it? I am using an external library for the MessageStream so cannot alter the arguments of the delegate...
void DoWork(ref int count)
{
MessageStream Stream = new MessageStream();
Stream.MessageReceived += (o, args) =>
{
//Error cannot use ref or out parameter inside anonymous method
count++;
};
}