Re: 請問一下這一段C#該如何轉成VB.Net?
我不知道是否有工具可以直接對轉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》 ◣◣◢ ─╯
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 4 篇):
Programming 近期熱門文章
PTT數位生活區 即時熱門文章