I have a method where I need to return a list of impedance measurements that are taken in magnitude and phase. C# Complex struct seem like a natural fit; but, its constructor uses rectilinear rather then polar notation. I see I can get phase; but, I don't see how I can set it.
Is there any other option than the following? It seems pretty messy.
Complex value = new Complex(Mag*Math.Cos(Phase),Mag*Math.Sin(Phase))
As @sdgfsdh indicates in their comment, use FromPolarCoordinates
:
Complex value = Complex.FromPolarCoordinates(Mag, Phase);