In order to work around an unusual situation, I need a function that does this:
object Identity(object x) { return x; }
It would solve my problem with a third-party library that I cannot change. I really don't want to create a new .NET DLL file just to introduce this function. Is there anything like this in any of the standard .NET libraries?
I am not writing any .NET code. I am calling into libraries from another wrapper environment. All I can do is send commands to instantiate objects or invoke methods/properties of objects. There's no place I can just write this function for myself. This identity function would help me avoid the garbage collector of the calling environment thinking that the object can be released.