DannyRoastBeef㊙
DannyRoastBeef㊙
CC#
Created by DannyRoastBeef㊙ on 4/3/2024 in #help
Using ref for large data types.
Right! Thanks for your help with a succinct answer and explanation. I was getting sick of trying to decipher the correct approach from StackOverflow :blobthumbsup:
10 replies
CC#
Created by DannyRoastBeef㊙ on 4/3/2024 in #help
Using ref for large data types.
Hi thanks for the reply. What about if I was to pass a list containing incoming data as I am here in my GET endpoint?
[HttpPost]
[Route("upload")]
public async Task<IActionResult> UploadDataAsync(List<IFormFile>? files)
{
if (files is not null && _env is not null)
{
return await _checkpoint.SaveDataToStorage(files);
}
return new StatusCodeResult(400);
}
[HttpPost]
[Route("upload")]
public async Task<IActionResult> UploadDataAsync(List<IFormFile>? files)
{
if (files is not null && _env is not null)
{
return await _checkpoint.SaveDataToStorage(files);
}
return new StatusCodeResult(400);
}
In the following function I've got
public async Task<IActionResult> SaveDataToStorage(List<IFormFile> files)
{
List<IFormFile> incomingFiles = files;

if (!CheckValidFileTypes(incomingFiles))
{
return new UnsupportedMediaTypeResult();
(There's more going on in here , shortened it for this post)
}
}
public async Task<IActionResult> SaveDataToStorage(List<IFormFile> files)
{
List<IFormFile> incomingFiles = files;

if (!CheckValidFileTypes(incomingFiles))
{
return new UnsupportedMediaTypeResult();
(There's more going on in here , shortened it for this post)
}
}
Would it be correct to put ref in front of
incomingFiles
incomingFiles
when calling the
CheckValidTypes
CheckValidTypes
function or will that do a copy?
10 replies
CC#
Created by DannyRoastBeef㊙ on 7/3/2023 in #help
❔ Can anyone break down this one-line code for me?
Oh so it's a lamda, I see. I think I'm going to have to read up on lamdas and Actions too. Thank you for your help, you've put me on the right track. 👍
11 replies
CC#
Created by DannyRoastBeef㊙ on 7/3/2023 in #help
❔ Can anyone break down this one-line code for me?
I'm not sure in this context haha. I'm under the impression => is used for lambda declaration and expression based properties. What does it mean in this context?
11 replies