private static IEnumerable <VsUIPropertyDescriptor> GetProperties(IVsUIDataSource dataSource)
        {
            Contract.Requires <ArgumentNullException>(dataSource != null, "dataSource");
            Contract.Ensures(Contract.Result <IEnumerable <VsUIPropertyDescriptor> >() != null);

            IVsUIEnumDataSourceProperties verbs;

            if (ErrorHandler.Succeeded(dataSource.EnumProperties(out verbs)))
            {
                VsUIPropertyDescriptor[] array = new VsUIPropertyDescriptor[1];
                while (true)
                {
                    uint count;
                    int  hr = verbs.Next((uint)array.Length, array, out count);
                    ErrorHandler.ThrowOnFailure(hr);
                    if (hr == VSConstants.S_FALSE || count == 0)
                    {
                        break;
                    }

                    for (uint i = 0; i < count; i++)
                    {
                        yield return(array[i]);
                    }
                }
            }
        }
Пример #2
0
        private static IEnumerable <VsUIPropertyDescriptor> GetProperties([NotNull] IVsUIDataSource dataSource)
        {
            Requires.NotNull(dataSource, nameof(dataSource));

            IVsUIEnumDataSourceProperties verbs;

            if (ErrorHandler.Succeeded(dataSource.EnumProperties(out verbs)))
            {
                VsUIPropertyDescriptor[] array = new VsUIPropertyDescriptor[1];
                while (true)
                {
                    uint count;
                    int  hr = verbs.Next((uint)array.Length, array, out count);
                    ErrorHandler.ThrowOnFailure(hr);
                    if (hr == VSConstants.S_FALSE || count == 0)
                    {
                        break;
                    }

                    for (uint i = 0; i < count; i++)
                    {
                        yield return(array[i]);
                    }
                }
            }
        }
        private static IEnumerable<VsUIPropertyDescriptor> GetProperties(IVsUIDataSource dataSource)
        {
            Contract.Requires<ArgumentNullException>(dataSource != null, "dataSource");
            Contract.Ensures(Contract.Result<IEnumerable<VsUIPropertyDescriptor>>() != null);

            IVsUIEnumDataSourceProperties verbs;
            if (ErrorHandler.Succeeded(dataSource.EnumProperties(out verbs)))
            {
                VsUIPropertyDescriptor[] array = new VsUIPropertyDescriptor[1];
                while (true)
                {
                    uint count;
                    int hr = verbs.Next((uint)array.Length, array, out count);
                    ErrorHandler.ThrowOnFailure(hr);
                    if (hr == VSConstants.S_FALSE || count == 0)
                        break;

                    for (uint i = 0; i < count; i++)
                        yield return array[i];
                }
            }
        }