How does the "ThrowHelper" .Net Framework class help lessen the generated IL code?

Viewed 196

I was looking at this and it its starting comments it says it exists because

throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));

generates more IL code than

ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key, ExceptionResource.ArgumentNull_Key);

which I can't find in the code, but like its similar methods I assume just calls throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key")); or something.

Does the ThrowHelper class really help lessen the IL code generated or is it the same (or more) considering the IL code generated from ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key, ExceptionResource.ArgumentNull_Key);?

EDIT: The IL shown at the start of the file, in the comments, is only from the call to ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key, ExceptionResource.ArgumentNull_Key); not the actual code inside that method. Or am I wrong?

0 Answers
Related