I have declared a string extension method to decode a Base64 string something like :
public static string DecodeFromBase64String(this string base64String)
{
return Encoding.UTF8.GetString(Convert.FromBase64String(base64String));
}
Now there is an async function which uploads a file and returns me a base64 encoded value of its id. So is it fine if I simply pass this function with await in parameter, something like:
// Approach 1
var fileId = StringExtensions.DecodeFromBase64String( await uplodFile(FilePath) );
Or should I just do a two step process, first get base64 id, and then decode it in next step. This requires me to either declare two variables with meaningful names, or just reuse same variable
// Approach 2
var base64fileId = await uploadFile(FilePath);
var fileId = StringExtensions.DecodeFromBase64String(base64fileId);
// Approach 3
var fileId = await uploadFile( Filepath); // at this step file Id doesn't make much sense, but reduces need of extra variable
fileId = StringExtensions.DecodeFromBase64String(fileId);
Which approach do you think is best considering design principles. I am still learning C#, so please excuse any of my mistakes.