My favorite part is that db is passed with ref when it's already a reference type. This, therefore, allows this method to redefine what db is outside of its own scope. Pain. That's probably why it's been error underlined, unnecessarily being passed with ref.
Edit: Apparently the error is because you can't pass in, out, or ref parameters in methods that yield.
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);
}
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
3
u/seeroflights Dec 06 '21
Image Transcription: Code
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
u/MTDninja Dec 09 '21
just.... return an array?
0
u/[deleted] Dec 06 '21
[deleted] — view deleted comment