Please enter the text to find and press Search.
Sorry

An error occurred during search results load.

How to Use Code Virtualization

To enable the code virtualization you should apply a custom attribute to your method. In order to do that you can use the instructions below.

Instructions on enabling code virtualization

  1. Open the source code of a method you want to virtualize
  2. Add a custom attribute as shown below (C#):

    using System;
    using System.Reflection;
    
    class YourClass
    {
        [Obfuscation(Feature = "virtualization", Exclude = false)]
        void YourMethod()
        {
            ...
        }
    }

    For Visual Basic .NET:

    Imports System
    Imports System.Reflection
    
    Class YourClass
    
        <Obfuscation(Feature:="virtualization", Exclude:=False)> 
        Sub YourMethod()
            ...
        End Sub
        
    End Class
    

[Note]Note

Virtualization can significantly slow down the speed of code execution, so please use this feature wisely.

Applying Code Virtualization to Multiple Methods at Once

It may beneficial to apply the code virtualization to the whole class or assembly. The conditional obfuscation can be employed to achieve that.

Examples are provided below.

Example 6.1. Virtualize all methods of a class

using System.Reflection;

[Obfuscation(Feature = "Apply to member * when method or constructor: virtualization", Exclude = false)]
class YourClass
{
    ...
}


Example 6.2. Virtualize all methods in assembly

using System.Reflection;

[assembly: Obfuscation(Feature = "Apply to type *: apply to member * when method or constructor: virtualization", Exclude = false)]


Sorry

An error occurred during page load.
You can try again or go back.