|Dotfuscator > Configuring Dotfuscator via the GUI > The Rules Editing Interface > Creating Custom Rules > Selecting By Method|
Method rules are qualified by type rules, so they appear in the rules view as children of type nodes. A method rule will select all methods (in all types matched by the parent type rule) that match your criteria. Supported matching criteria include method name, method attributes, and signature.
You create a method rule by right clicking on the parent type rule’s node and selecting Add Method, then typing a name in the Name field. The name will be interpreted as a regular expression if the Regular Expression checkbox is checked; otherwise the name will be interpreted literally.
In addition to method name, you can also select based on method attribute specifiers, using the values provided in the Attribute Specifier list box. A ‘-‘ preceding an attribute specifier negates the attribute (i.e. it selects all methods that do not have the specified attribute). You can select multiple attributes from the list; the criteria implied by multiple selections are logically
AND-ed together (that is, the set of selected methods is the intersection of all methods that match each attribute specifier.). For example, you can select methods that are both public and virtual by selecting +public and +virtual from the list.
The attribute specifications are logically
AND-ed with the method name and signature list, so if you want to select all methods with a specific set of attributes, you need to provide a regular expression for the method name that selects all methods (i.e. ".*").
You can also select methods by signature. A signature specifies both the return type and the parameter types of the method. The method signature reduces the scope of the method rule, so if you want to create a rule that selects methods regardless of signature, you need to provide a regular expression for the signature that selects all signatures (i.e. ".*"). This is the default value.
The corresponding method node displayed in the rule editing view has a child element that indicates whether the rule is a regular expression and whether the rule has attribute specifiers, and/or a signature associated with it. You can preview the items selected by the rule by right clicking on the node and selecting the Preview option from the menu.
In the screen shot, a method rule is defined that selects the names of all public methods (in all types) whose names start with "S".