C# Cast Entire Array?

前端 未结 4 1081
鱼传尺愫
鱼传尺愫 2020-11-30 09:43

I see this Array.ConvertAll method, but it requires a Converter as an argument. I don\'t see why I need a converter, when I\'ve already defined an

4条回答
  •  感动是毒
    2020-11-30 09:56

    As an update to this old question, you can now do:

    myArray.Cast().ToArray();
    

    where myArray contains the source objects, and Vec2 is the type you want to cast to.

提交回复
热议问题