public RTCErrorType SetCodecPreferences(RTCRtpCodecCapability[] codecs) { RTCRtpCodecCapabilityInternal[] array = Array.ConvertAll(codecs, v => v.Cast()); MarshallingArray <RTCRtpCodecCapabilityInternal> instance = array; RTCErrorType error = NativeMethods.TransceiverSetCodecPreferences(self, instance.ptr, instance.length); foreach (var v in array) { v.Dispose(); } instance.Dispose(); return(error); }