小编Hex*_*exo的帖子

我们是谁保护我们的课程?

我正在学习C#,我想知道,声明类/方法私有的重点是什么?我们是谁隐藏/限制对这些类的访问.

因为如果某人正在编辑源代码,他们可以将标记从私有更改为公共.我不确定用户如何能够访问这些方法以及它会导致什么问题.

tldr; 访问修饰符有什么意义.

谢谢!

oop encapsulation access-modifiers

6
推荐指数
1
解决办法
119
查看次数

将.dll嵌入到.exe中

可能重复:
在c#.exe中嵌入.net dll

我一直在尝试将.dll(特别是Ionic.Zip.dll)嵌入到我的应用程序中,然后使用CodeDom编译新的.exe并需要Ionic.Zip.dll.我希望能够在没有任何额外的.dll的情况下分发我的程序.如果工作目录中有DLL,则程序和编译的程序运行正常.我没有使用ILMerge,因为编译的程序需要.dll而我不能强迫用户获取ILMerge.但是,如果没有.dll,我会收到此错误.

原始程序不会使用此错误编译代码

error CS0006: Metadeta file 'Ionic.Zip.dll" could not be found.
Run Code Online (Sandbox Code Playgroud)

编译程序(在原始程序的工作目录中具有dll时编译)

Description:
Stopped working

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01:   scrub.exe
Problem Signature 02:   0.0.0.0
Problem Signature 03:   50b0f364
Problem Signature 04:   Scrub
Problem Signature 05:   0.0.0.0
Problem Signature 06:   50b0f364
Problem Signature 07:   1
Problem Signature 08:   38
Problem Signature 09:   System.IO.FileNotFoundException
OS Version: 6.1.7601.2.1.0.256.48
Locale ID:  1033
Run Code Online (Sandbox Code Playgroud)

调试错误

Could not load file or assembly 'Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c' or one of …
Run Code Online (Sandbox Code Playgroud)

c# embed dll dotnetzip

5
推荐指数
0
解决办法
1795
查看次数

标签 统计

access-modifiers ×1

c# ×1

dll ×1

dotnetzip ×1

embed ×1

encapsulation ×1

oop ×1