Reputation: 33
Im looking to how i can exclude a line of code in my project, but all i found is how to exclude a complete namespace, can you help me ?
Upvotes: 3
Views: 2012
Reputation: 4954
.NET has an attribute called ObfuscationAttribute, which has an Exclude property.
The documentation for Exclude
says:
Gets or sets a Boolean value indicating whether the obfuscation tool should exclude the type or member from obfuscation.
You should be able to add [Obfuscation(Exclude = true)]
to the member(s) you want to exclude. If the obfuscator tool you're using properly respect this attribute (ConfuserEx should be respecting this AFAIK), it should get the work done.
Example:
[Obfuscation(Exclude = true)]
public class MyClass
{
[Obfuscation(Exclude = true)]
public enum MyEnum
{
Value1,
Value2,
}
[Obfuscation(Exclude = true)]
public void MyFunction(MyEnum e_Enum)
{
}
}
Upvotes: 3