private string inet_ntoa(NetAddress address) { IntPtr num = Marshal.AllocHGlobal(Marshal.SizeOf((object)address)); StringBuilder addr_str = new StringBuilder(); addr_str.Capacity = 46; Marshal.StructureToPtr((object)address, num, true); NetInterfaceConfig.sigar_net_address_to_string(IntPtr.Zero, num, addr_str); return(addr_str.ToString()); }
private string inet_ntoa(NetAddress address) { //XXX seems a little stilly, we can't use &address IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(address)); StringBuilder buffer = new StringBuilder(); buffer.Capacity = 46; Marshal.StructureToPtr(address, ptr, true); sigar_net_address_to_string(IntPtr.Zero, ptr, buffer); return(buffer.ToString()); }
private string inet_ntoa(NetAddress address) { //XXX seems a little stilly, we can't use &address IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(address)); StringBuilder buffer = new StringBuilder(); buffer.Capacity = 46; Marshal.StructureToPtr(address, ptr, true); sigar_net_address_to_string(IntPtr.Zero, ptr, buffer); return buffer.ToString(); }