示例#1
0
        public static ImaqdxEnumAttributeItem[] EnumerateAttributeValues(ImaqdxSessionHandle session, string name)
        {
            Debug.Assert(session != null, "The session parameter cannot be null.");
            Debug.Assert(!session.IsInvalid, "The session parameter must be a valid handle.");
            Debug.Assert(name != null, "The name parameter cannot be null.");

            uint count;
            int  status = NiImaqdxDll.IMAQdxEnumerateAttributeValues(session, name, null, out count);

            ExceptionBuilder.CheckErrorAndThrow(status);
            ImaqdxEnumItem[] enumItemArray = new ImaqdxEnumItem[count];
            status = NiImaqdxDll.IMAQdxEnumerateAttributeValues(session, name, enumItemArray, out count);
            ExceptionBuilder.CheckErrorAndThrow(status);

            ImaqdxEnumAttributeItem[] enumItems = new ImaqdxEnumAttributeItem[count];
            for (int i = 0; i < count; i++)
            {
                enumItems[i] = new ImaqdxEnumAttributeItem(enumItemArray[i]);
            }
            return(enumItems);
        }