问题
In C# we can decorate methods with Attributes for numerous purposes.
E.g:
[Activity (Label = "My Activity", MainLauncher = true)]
public class MainActivity : Activity
This particular example is from Xamarin, it goes off and auto builds the Android Manifest file based on these attributes.
I want to know if there is any way to get the compiler to globally ignore these attributes? i.e Disable Attribute processing altogether.
My actual end goal is to manually generate my Android Manifest file myself but still keep these Attributes in the classes. I'm using Visual Studio 2012.
回答1:
Perhaps a conditional compilation would do?
#if DEBUG
[Activity (Label = "My Activity", MainLauncher = true)]
#endif
public class MainActivity : Activity
来源:https://stackoverflow.com/questions/26162056/is-it-possible-to-ignore-attributes-in-c-or-disable-the-processing-of-them