C#C
C#2y ago
9 replies
DannyRoastBeef㊙

Using ref for large data types.

Hi, just looking for a little clarification on the ref keyword when passing data into a function.
I've hot an API endpoint which takes in files which passes them though to a function which checks them and sorts them into an appropriate destination directory.

I've got a function in another class which checks the data type is supported, among other things. Would I be right to pass the incoming multipart File data to it using a ref value to avoid making a copy of it? Some of the files can run up to 200mb in size.

Thanks for any help.
Was this page helpful?