/// <summary> /// Creates the <see cref="IPAddress"/> object from the specified pointer to address string /// </summary> /// <param name="pAddress">The pointer to the address string /// (<seealso cref="IntPtr"/>)</param> /// <exception cref="ArgumentException">Thrown, /// if passed <see cref="AGDnsApi.ag_buffer.size"/> is not acceptable</exception> /// <returns><see cref="IPAddress"/> object or null if the pointer is null or addressLength is zero</returns> private static IPAddress CreateIpAddress(IntPtr pAddress) { if (pAddress == IntPtr.Zero) { return(null); } string address = MarshalUtils.PtrToString(pAddress); IPAddress ipAddress = IPAddress.Parse(address); return(ipAddress); }
/// <summary> /// Converts the unmanaged data to managed data. /// </summary> /// <param name="pNativeData">A pointer to the unmanaged data to be wrapped. </param> /// <returns>An object that represents the managed view of the COM data.</returns> public object MarshalNativeToManaged(IntPtr pNativeData) { string managedString = MarshalUtils.PtrToString(pNativeData); return(managedString); }