Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference a big DLL for a single method

I want to use a single method from a big Class library-dll in C#.

Are there any drawbacks of performance or anything else?
Should I "read" the method code with reflection tool and copy-paste it to my project?

Update: The hard disk space isn't an issue. My application is web app.

like image 281
gdoron is supporting Monica Avatar asked Dec 16 '22 05:12

gdoron is supporting Monica


2 Answers

Are there any drawbacks of performance or anything else?

The only one that is actually important is the size of your distributable, if it matters to you. (Users downloading a 30 MB file instead of a 2 MB one). Performance differences will be negligible. Assembly binding and verifying the Strong Name (if it's signed) hash may take longer, but unlikely to be noticeable to a user.

Should I "read" the method code with reflection tool and copy-paste it to my project?

Probably not; most licensing terms prohibit reverse engineering and/or only partial distribution. Check the license, if any, to see if you can even do it first.

like image 108
vcsjones Avatar answered Dec 18 '22 20:12

vcsjones


No, leave that up to the JIT compiler. It is already selective about what IL actually gets turned into machine code, it only compiles what actually executes. You'll lose a bit of virtual memory address space but that doesn't cost anything, it's virtual. You don't pay for what you don't use.

like image 21
Hans Passant Avatar answered Dec 18 '22 20:12

Hans Passant