简体   繁体   中英

Can we decompile a C# dll to VB.NET

I have developed a dll in C#.net. Can we decompile the same in VB.net. If yes, how to do that?

Use a tool like Reflector to convert a compiled C# assembly (IL) into decompiled VB.NET source code (might lose some meaning with certain variable names). Another post mentions some free alternatives to Reflector.

Or convert the C# code using an online resource such as this one (1 code file at a time though).

I agree with Mitch, but as a free alternative to Reflector:

Assuming you have the source, you can use sharpdevelop to convert whole solutions back and forth between c#.net and vb.net

The same group also developed a plugin for visual studio: Code Converter C# to/from VB.NET

Sometimes C# cannot be converted (or decompiled) into VB.Net because there are some elements of C# that have no equivalent in VB. Eg iterators ( yield ) and unsafe code. Furthermore some of the free converters fail badly even when there are direct equivalents.

Why do you want to do this anyway? It's probably easy to just use the C# DLL from VB.Net code: you can call it, you can inherit from it. " CLS compliance " will help with this.

For what it's worth, it's also true that there are some elements of VB that have no equivalent in C#, eg exception filters.

If you've developed it your self I assume you have access to the source? If so you can just convert it all though here:

http://www.developerfusion.com/tools/convert/csharp-to-vb/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM