在vb.net版块一天没搞定 急需大家帮忙

流星尔 2009-03-11 06:48:38
以下代码不知道如何转成VB.NET,特别[PreserveSig]这些有[]括号括起来的,不知道是什么意思。谢谢

namespace ShellLib
{

[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("00000002-0000-0000-C000-000000000046")]
public interface IMalloc
{
// Allocates a block of memory.
// Return value: a pointer to the allocated memory block.
[PreserveSig]
IntPtr Alloc(
UInt32 cb); // Size, in bytes, of the memory block to be allocated.

// Changes the size of a previously allocated memory block.
// Return value: Reallocated memory block
[PreserveSig]
IntPtr Realloc(
IntPtr pv, // Pointer to the memory block to be reallocated.
UInt32 cb); // Size of the memory block (in bytes) to be reallocated.

// Frees a previously allocated block of memory.
[PreserveSig]
void Free(
IntPtr pv); // Pointer to the memory block to be freed.

// This method returns the size (in bytes) of a memory block previously allocated with
// IMalloc::Alloc or IMalloc::Realloc.
// Return value: The size of the allocated memory block in bytes
[PreserveSig]
UInt32 GetSize(
IntPtr pv); // Pointer to the memory block for which the size is requested.

// This method determines whether this allocator was used to allocate the specified block of memory.
// Return value: 1 - allocated 0 - not allocated by this IMalloc instance.
[PreserveSig]
Int16 DidAlloc(
IntPtr pv); // Pointer to the memory block

// This method minimizes the heap as much as possible by releasing unused memory to the operating system,
// coalescing adjacent free blocks and committing free pages.
[PreserveSig]
void HeapMinimize();
}
}
...全文
69 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lovebgh0923 2009-03-11
  • 打赏
  • 举报
回复
在网上搜搜,有直接将c#转成vb.net的东东
vwxyzh 2009-03-11
  • 打赏
  • 举报
回复
特性,
c#的[PreserveSig]
就是vb.net的<PreserveSig>
顺便说一下,如果换行的话别忘了vb的换行符
流星尔 2009-03-11
  • 打赏
  • 举报
回复
非常感谢
readfuture 2009-03-11
  • 打赏
  • 举报
回复
友情帮顶

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧