Search code examples
c#.nettypedreference

Practical uses of TypedReference


Are there any practical uses of the TypedReference struct that you would actually use in real code?

EDIT: The .Net framework uses them in overloads of Console.WriteLine and String.Concat which build an array from an __arglist parameter and pass it to the normal params overload. Why do these overloads exist?


Solution

  • Are there any practical uses of the TypedReference struct that you would actually use in real code?

    Yes. I'd use them if I needed interoperability with C-style variadic methods.

    Why do these overloads exist?

    They exist for interoperability with callers who like to use C-style variadic methods.