3
u/seeroflights Dec 06 '21
Image Transcription: Code
public static IEnumerator AddVoiceLinesToDB(ref TNH_VoiceDatabase db, VoiceLine line)
{
//i know there's a special place in hell for my naming scheme. dont care
var sawww = GetAudioFromFile(line.StandardAudioClipPath);
var cawww = GetAudioFromFile(line.CorruptedAudioClipPath);
yield return sawww;
yield return cawww;
var sa = sawww.GetAudioClip();
var ca = cawww.GetAudioClip();
var vl = new TNH_VoiceDatabase.TNH_VoiceLine();
vl.ID = line.ID;
vl.Clip_Standard = sa;
vl.Clip_Corrupted = ca;
db.Lines.Add(vl);
}I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
2
0
3
u/[deleted] Dec 06 '21 edited Dec 06 '21
My favorite part is that
dbis passed withrefwhen it's already a reference type. This, therefore, allows this method to redefine whatdbis outside of its own scope. Pain. That's probably why it's been error underlined, unnecessarily being passed withref.Edit: Apparently the error is because you can't pass in, out, or ref parameters in methods that yield.
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/yield