internal ManagedPropSpec(PROPSPEC propSpec)
        {
            SecurityHelper.DemandUnmanagedCode();
            PropSpecType propType = (PropSpecType)propSpec.propType;

            if (propType == PropSpecType.Name)
            {
                this.PropName = Marshal.PtrToStringUni(propSpec.union.name);
                return;
            }
            if (propType == PropSpecType.Id)
            {
                this.PropId = propSpec.union.propId;
                return;
            }
            throw new ArgumentException(SR.Get("FilterPropSpecUnknownUnionSelector"), "propSpec");
        }
        internal static void MarshalPropSpec(ManagedPropSpec propSpec, ref PROPSPEC native)
        {
            native.propType = (uint)propSpec.PropType;
            PropSpecType propType = propSpec.PropType;

            if (propType == PropSpecType.Name)
            {
                native.union.name = Marshal.StringToCoTaskMemUni(propSpec.PropName);
                return;
            }
            if (propType == PropSpecType.Id)
            {
                native.union.propId = propSpec.PropId;
                return;
            }
            Invariant.Assert(false);
        }