Re: 請問一下這一段C#該如何轉成VB.Net?

看板Programming作者時間18年前 (2007/09/23 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
為了避免我這種脫褲子放屁的解法, 上網 google 了一下, 找到了 一個方便的網頁工具直接做語法對轉: http://www.kamalpatel.net/ConvertCSharp2VB.aspx (喔! 原 PO 沒有先上 Google 做功課喔...., 我搜到這網頁前後不花五分鐘) ※ 引述《Contactman (小白退散!)》之銘言: : 我不知道是否有工具可以直接對轉C# & VB.NET, 但是我知道有個工具 : 可以解析 MSIL 對應到任何.NET的語言, 包括C#, VB.NET, Delphi.NET...etc. : 你可以搜尋 .Net Reflector 這個程式. : 但是由於它屬於Disassembler(反組譯器), 且用MSIL當轉譯的Source. : 所以你必須先將C#程式編譯成組件Assembly後再用它來反組譯成 VB.NET. : 聽起來是有點脫褲子放屁的味道啦... : 但這只是我的經驗分享. : ※ 引述《quota@kkcity.com.tw (大改名片檔)》之銘言: : : 請問是否有軟體可以協助轉換呢? : : 不過我想我應該要多瞭解C#寫法了 : : 附上語法,煩請協助,謝謝! : : using System; : : using System.Drawing; : : using System.Runtime.InteropServices; : : namespace C2C.FileSystem : : { : : public class ShellIcon : : { : : [StructLayout(LayoutKind.Sequential)] : : public struct SHFILEINFO : : { : : public IntPtr hIcon; : : public IntPtr iIcon; : : public uint dwAttributes; : : [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] : : public string szDisplayName; : : [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] : : public string szTypeName; : : }; : : class Win32 : : { : : public const uint SHGFI_ICON = 0x100; : : public const uint SHGFI_LARGEICON = 0x0; // 'Large icon : : public const uint SHGFI_SMALLICON = 0x1; // 'Small icon : : [DllImport("shell32.dll")] : : public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, : : ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags); : : } : : public ShellIcon() : : { : : // : : // TODO: Add constructor logic here : : // : : } : : public static Icon GetSmallIcon(string fileName) : : { : : IntPtr hImgSmall; //the handle to the system image list : : SHFILEINFO shinfo = new SHFILEINFO(); : : //Use this to get the small Icon : : hImgSmall = Win32.SHGetFileInfo(fileName, 0, ref shinfo,(uint)Marshal.SizeOf(shi : : nfo),Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON); : : //The icon is returned in the hIcon member of the shinfo struct : : return System.Drawing.Icon.FromHandle(shinfo.hIcon); : : } : : public static Icon GetLargeIcon(string fileName) : : { : : IntPtr hImgLarge; //the handle to the system image list : : SHFILEINFO shinfo = new SHFILEINFO(); : : //Use this to get the large Icon : : hImgLarge = Win32.SHGetFileInfo(fileName, 0, ref shinfo, (uint)Marshal.SizeOf(sh : : info), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON); : : //The icon is returned in the hIcon member of the shinfo struct : : return System.Drawing.Icon.FromHandle(shinfo.hIcon); : : } : : } : : } -- ╭──── Origin:<不良牛牧場> bbs.badcow.com.tw (210.200.247.200)─────╮ Welcome to SimFarm BBS -- From : [220.138.41.202] ◣◣◢ ◢◢不良牛免費撥接→電話:40586000→帳號:zoo→密碼:zoo ◣◣─╯
文章代碼(AID): #16zLXW00 (Programming)
文章代碼(AID): #16zLXW00 (Programming)