コード例 #1
0
ファイル: Interop.VARIANT.cs プロジェクト: tbolon/winforms
            private static Type GetRecordElementType(IRecordInfo record)
            {
                Guid    guid;
                HRESULT hr = record.GetGuid(&guid);

                hr.ThrowIfFailed();

                Type?t = System.Type.GetTypeFromCLSID(guid);

                if (t is null || !t.IsValueType)
                {
                    throw new ArgumentException("The specified record cannot be mapped to a managed value class.");
                }

                return(t);
            }
コード例 #2
0
            private static Type GetRecordElementType(IRecordInfo record)
            {
                Guid    guid;
                HRESULT hr = record.GetGuid(&guid);

                if (!hr.Succeeded())
                {
                    throw Marshal.GetExceptionForHR((int)hr) !;
                }

                Type?t = System.Type.GetTypeFromCLSID(guid);

                if (t is null || !t.IsValueType)
                {
                    throw new ArgumentException("The specified record cannot be mapped to a managed value class.");
                }

                return(t);
            }