How to make ObjectListView work in obfuscated code

2019-08-11 20:23发布

问题:

ObjectListView stops working when i obfuscate the code. The issue seems to be centred around using AspectName to set the column in MainForm.designer.cs
E.g:

this.olvColumn1.AspectName = "Name";

The Obfuscator could be renaming all my methods. Any advice on how to fix this issue?

回答1:

AspectName is obviously using the name of the property, which is defeated by obfuscating.

You'll have to install an AspectGetter delegate instead:

this.olvColumn1.AspectGetter = delegate(object x) {
    return ((YourModelClass)x).Name;
}