ObfuscateAssemblyAttribute(Boolean) 建構函式

定義

初始化 ObfuscateAssemblyAttribute 類別的新執行個體,並指定要模糊化的組件是公用或私用。Initializes a new instance of the ObfuscateAssemblyAttribute class, specifying whether the assembly to be obfuscated is public or private.

public:
 ObfuscateAssemblyAttribute(bool assemblyIsPrivate);
public ObfuscateAssemblyAttribute (bool assemblyIsPrivate);
new System.Reflection.ObfuscateAssemblyAttribute : bool -> System.Reflection.ObfuscateAssemblyAttribute
Public Sub New (assemblyIsPrivate As Boolean)

參數

assemblyIsPrivate
Boolean

如果組件是用於某個應用程式的範圍中,則為 true,否則為 falsetrue if the assembly is used within the scope of one application; otherwise, false.

範例

下列程式碼範例會示範屬性的方法, 如何將元件指定為私用。The following code example shows how the attribute constructor specifies that an assembly is private. StripAfterObfuscation屬性為false, 以防止模糊化工具在處理後去除屬性。The StripAfterObfuscation property is false, to prevent the obfuscation tool from stripping the attribute after processing.

using System;
using System.Reflection;

[assembly: ObfuscateAssemblyAttribute(true, 
    StripAfterObfuscation=false)]
Imports System.Reflection

<Assembly: ObfuscateAssemblyAttribute(False, _
    StripAfterObfuscation:=False)>

備註

如果元件僅供您的應用程式使用, 而且不是其他軟體要使用的程式庫, 請將它們標示為私用。Mark assemblies as private if they are used only by your application, and are not libraries to be used by other software. 一般來說, 將元件標示為私用會告訴混淆程式, 它可以在模糊處理應用程式的過程中, 將所有方法的名稱 (包括公用方法) 模糊。Generally, marking an assembly as private tells an obfuscator that it can obfuscate the names of all methods, including public methods, as part of obfuscating an application. 如果元件是公用的, 則混淆程式不應該模糊處理公用成員的名稱。If an assembly is public, an obfuscator should not obfuscate the names of public members.

重要

套用這個屬性並不會自動模糊處理元件。Applying this attribute does not automatically obfuscate the assembly. 套用屬性是建立模糊化工具之設定檔的替代方法。Applying the attribute is an alternative to creating a configuration file for the obfuscation tool. 也就是說, 它只提供模糊化工具的指示。That is, it merely provides instructions for an obfuscation tool. Microsoft 建議混淆工具的廠商遵循這裡所述的語法。Microsoft recommends that vendors of obfuscation tools follow the semantics described here. 不過, 並不保證特定工具會遵循 Microsoft 建議。However, there is no guarantee that a particular tool follows Microsoft recommendations.

適用於