/// <summary> /// Sets the fields of the object from a native JET_ERRINFOBASIC struct. /// </summary> /// <param name="value"> /// The native errinfobasic to set the values from. /// </param> internal void SetFromNative( ref NATIVE_ERRINFOBASIC value) { unchecked { this.errValue = value.errValue; this.errcat = value.errcatMostSpecific; if (value.rgCategoricalHierarchy != null) { for (int i = 0; i < value.rgCategoricalHierarchy.Length; ++i) { this.rgCategoricalHierarchy[i] = (JET_ERRCAT)value.rgCategoricalHierarchy[i]; } } this.lSourceLine = (int)value.lSourceLine; this.rgszSourceFile = value.rgszSourceFile; } }
/// <summary> /// Gets the native (interop) version of this object. /// </summary> /// <returns>The native (interop) version of this object.</returns> internal NATIVE_ERRINFOBASIC GetNativeErrInfo() { var native = new NATIVE_ERRINFOBASIC(); native.cbStruct = checked ((uint)Marshal.SizeOf(typeof(NATIVE_ERRINFOBASIC))); native.errValue = this.errValue; native.errcatMostSpecific = this.errcat; native.rgCategoricalHierarchy = new byte[NATIVE_ERRINFOBASIC.HierarchySize]; if (this.rgCategoricalHierarchy != null) { for (int i = 0; i < this.rgCategoricalHierarchy.Length; ++i) { native.rgCategoricalHierarchy[i] = (byte)this.rgCategoricalHierarchy[i]; } } native.lSourceLine = (uint)this.lSourceLine; native.rgszSourceFile = this.rgszSourceFile; return(native); }