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.

適用於