/* Copyright (C) 2019 Interactive Brokers LLC. All rights reserved. This code is subject to the terms * and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable. */ using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; namespace TWSLib { [ComVisible(true), Guid("BE3E5CD3-6F13-4D39-981C-4F75C063C2BA")] public interface IComboLegList { [DispId(-4)] object _NewEnum { [return:MarshalAs(UnmanagedType.IUnknown)] get; } [DispId(0)] object this[int index] { [return:MarshalAs(UnmanagedType.IDispatch)] get; } [DispId(1)] int Count { get; } [DispId(2)] [return: MarshalAs(UnmanagedType.IDispatch)] object Add(); } [ComVisible(true), ClassInterface(ClassInterfaceType.None)] public class ComComboLegList : IComboLegList { private ComList Ocl; public ComComboLegList() : this(null) { } public ComComboLegList(ComList cbl) { this.Ocl = cbl == null ? new ComList(new List()) : cbl; } public object _NewEnum { get { return Ocl.GetEnumerator(); } } public object this[int index] { get { return Ocl[index]; } } public int Count { get { return Ocl.Count; } } public object Add() { var rval = new ComComboLeg(); Ocl.Add(rval); return rval; } public static implicit operator ComList(ComComboLegList from) { return from.Ocl; } } }