开发者

create a class in c# in a way where I am just able to use it but I am not able to see the code of that class

I have a class named CreateListView in my project in a .cs file and I am able to use it by including it's namespace in my usings at the top of my page. Is there a way I can compile the file so that I can still use the class but users are not able to see开发者_开发技巧 the contents of the class. I want the users to still be able to create objects from that class but I don't want them to modify it and it will also be better if they could not see it.


You can put it in a separate project (Class Library), compile it as a DLL and give others the binary to use in their projects.


As others have said, you want to compile it into a Class Library, and then distribute the resulting DLL. If you really don't want them to be able to see into it with a tool like Reflector, then you should also consider using an obfuscator.


You would want to place the code in a seperate project and then build it and give them the .dll this will allow them to use the class you've created but not see the code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜