I have a class with a static property whose value I would like to retrieve without creating an instance of the object:
public partial class CustomDialog : CustomDialogBaseDevice, ICustomDialog
{
public static new string TypeId
{
get
{
return "Type1234";
}
}
}
I have managed to succeed using the following code:
PropertyInfo prop = t.GetProperty("TypeId");
object propValue = prop.GetValue(null, null);
string typeID = propValue.ToString();
This actually works great...until I obfuscate the DLL containing "CustomDialog". It still finds the property but fails when trying to get the value. I've tried a number of things including using a constant instead of a property and trying dozens of combinations of ObfuscationAttributes to try to exclude the property from obfuscation. So far, the only thing that works is to leave the entire DLL un-obfuscated.
Does anyone know a way to do this while still obfuscating the DLL?
Aucun commentaire:
Enregistrer un commentaire