![jetbrains annotations jetbrains annotations](https://img2020.cnblogs.com/blog/1120344/202012/1120344-20201218170151398-173017743.png)
Prevents the Member Reordering feature from tossing members of the marked class. Specify a string that "follows" injected string literal.įor more information, see Use. Specify a string that "precedes" injected string literal.
#Jetbrains annotations code#
Specify a language of injected code fragment. cssProps should only contains a list of CSS properties For more information, see manage and share resharper settings.Public class Foo : INotifyPropert圜hanged ")] string cssProps) If there are several namespaces in the list, select the one that should be used by the ReSharper code analysis engine it in the Default annotation namespace list.Ĭlick Save in the Options dialog to apply the modifications and let ReSharper choose where to save them, or save the modifications to a specific settings layer using the Save To list. Check the entry that contains the desired implementation. Select ReSharper | Options from the main menu or press Alt+R O, then choose Code Inspection | Code Annotations on the left.Īll namespaces (from both source code and referenced assemblies) other than JetBrains.Annotations with the annotation classes (ReSharper will only look for CanBeNullAttribute and NotNullAttribute declarations) are shown in the Namespaces with code annotation attributes list. Change sources of code annotation attributes In such cases, you can choose namespaces where ReSharper should look for the proper set of the annotations-attributes classes. There also may be cases when your solution contains several implementations of the annotation attributes, for example, you have classes with the same names as ReSharper annotations classes ( CanBeNullAttribute, NotNullAttribute, and so on) or you are using a third-party assembly that contains ReSharper annotation classes. However, if the declarations are in a different namespace you should explicitly specify the namespace with annotation attributes as described below. You can put the declarations anywhere in your solution - ReSharper will detect them automatically. The default implementation of the annotation attributes are declared in the JetBrains.Annotations namespace, but this namespace is not required for the annotations to work. Optionally, when copying you can choose to make the declarations internal and/or add the attribute to the declarations. You can get a copy of the code-annotations declarations on the Code Inspection | Code Annotations page of ReSharper options ( Alt+R, O). Embed declarations of code annotations in your source code If the JetBrains.Annotations is referenced or attribute declarations are embedded in any of the projects within your solution, you can type the desired annotation attribute and press Alt+Enter to invoke the quick-fix that will reference this module in the current project and add the missing using directive:Īlternatively, you can press Control+Alt+Space twice to invoke the double import completion, which will find the attribute, import the namespace, and add the reference. You can also embed attribute declarations anywhere in your project, using the default JetBrains.Annotations namespace, or any other namespace. You can add a project reference to the, which you can find in the ReSharper installation directory. Just add the using JetBrains.Annotations directive, and use the corresponding Alt+Enter action to automatically fetch the package.
#Jetbrains annotations install#
The recommended way is to install the NuGet package with the JetBrains.Annotations assembly.Īctually, you do not even need to go to the NuGet website to get the package. To make use of the annotation attributes in your project, you should reference them in your project: Enable code annotations support in your project However, you can define 'JETBRAINS_ANNOTATIONS' conditional compilation symbol in your projects to preserve the attributes in the metadata. The easiest way to benefit from ReSharper's code annotations is to add the annotation attributes to symbols of your source code and make ReSharper analyze your solution with greater accuracy and insight.īy default, all annotation attribute classes are marked with attribute so the compiler will ignore the attribute usages in your code, which means that no binary reference to the '' assembly will be produced.