/// <summary>Converts the value of this instance to the equivalent OLE Automation date.</summary> /// <param name="dateTime">A DateTime structure.</param> /// <returns>A double-precision floating-point number that contains an OLE Automation date equivalent to the value of this instance.</returns> /// <exception cref="T:System.OverflowException">The value of this instance cannot be represented as an OLE Automation Date. </exception> /// <filterpriority>2</filterpriority> public static double ToOADate(this DateTime dateTime) { return(LibraryHelpers.TicksToOADate(dateTime.Ticks)); }
/// <summary> /// Get the offset in the cached buffers array to start allocating or freeing /// buffers to. This is done so that all threads don't start operating on /// slot zero, which would increase contention. /// </summary> /// <returns>The starting offset for Allocate/Free operations.</returns> private int GetStartingOffset() { // Using the current CPU number would be ideal, but there doesn't seem to // be a cheap way to get that information in managed code. return(LibraryHelpers.GetCurrentManagedThreadId() % this.cachedBuffers.Length); }
/// <summary> /// Free the string memory. /// </summary> public void FreeHGlobal() { LibraryHelpers.MarshalFreeHGlobal(this.szDatabaseName); LibraryHelpers.MarshalFreeHGlobal(this.szNewDatabaseName); }