Winify – Diff between revs 6 and 25
?pathlinks?
Rev 6 | Rev 25 | |||
---|---|---|---|---|
1 | /* MIT License |
1 | /* MIT License |
|
2 | |
2 | |
|
3 | Copyright (c) 2016 JetBrains http://www.jetbrains.com |
3 | Copyright (c) 2016 JetBrains http://www.jetbrains.com |
|
4 | |
4 | |
|
5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6 | of this software and associated documentation files (the "Software"), to deal |
6 | of this software and associated documentation files (the "Software"), to deal |
|
7 | in the Software without restriction, including without limitation the rights |
7 | in the Software without restriction, including without limitation the rights |
|
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 | copies of the Software, and to permit persons to whom the Software is |
9 | copies of the Software, and to permit persons to whom the Software is |
|
10 | furnished to do so, subject to the following conditions: |
10 | furnished to do so, subject to the following conditions: |
|
11 | |
11 | |
|
12 | The above copyright notice and this permission notice shall be included in all |
12 | The above copyright notice and this permission notice shall be included in all |
|
13 | copies or substantial portions of the Software. |
13 | copies or substantial portions of the Software. |
|
14 | |
14 | |
|
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
21 | SOFTWARE. */ |
21 | SOFTWARE. */ |
|
22 | |
22 | |
|
23 | using System; |
23 | using System; |
|
24 | |
24 | |
|
25 | // ReSharper disable InheritdocConsiderUsage |
25 | // ReSharper disable InheritdocConsiderUsage |
|
26 | |
26 | |
|
27 | #pragma warning disable 1591 |
27 | #pragma warning disable 1591 |
|
28 | // ReSharper disable UnusedMember.Global |
28 | // ReSharper disable UnusedMember.Global |
|
29 | // ReSharper disable MemberCanBePrivate.Global |
29 | // ReSharper disable MemberCanBePrivate.Global |
|
30 | // ReSharper disable UnusedAutoPropertyAccessor.Global |
30 | // ReSharper disable UnusedAutoPropertyAccessor.Global |
|
31 | // ReSharper disable IntroduceOptionalParameters.Global |
31 | // ReSharper disable IntroduceOptionalParameters.Global |
|
32 | // ReSharper disable MemberCanBeProtected.Global |
32 | // ReSharper disable MemberCanBeProtected.Global |
|
33 | // ReSharper disable InconsistentNaming |
33 | // ReSharper disable InconsistentNaming |
|
34 | |
34 | |
|
35 | namespace Servers.Annotations |
35 | namespace Servers.Properties |
|
36 | { |
36 | { |
|
37 | /// <summary> |
37 | /// <summary> |
|
38 | /// Indicates that the value of the marked element could be <c>null</c> sometimes, |
38 | /// Indicates that the value of the marked element could be <c>null</c> sometimes, |
|
39 | /// so checking for <c>null</c> is required before its usage. |
39 | /// so checking for <c>null</c> is required before its usage. |
|
40 | /// </summary> |
40 | /// </summary> |
|
41 | /// <example> |
41 | /// <example> |
|
42 | /// <code> |
42 | /// <code> |
|
43 | /// [CanBeNull] object Test() => null; |
43 | /// [CanBeNull] object Test() => null; |
|
44 | /// |
44 | /// |
|
45 | /// void UseTest() { |
45 | /// void UseTest() { |
|
46 | /// var p = Test(); |
46 | /// var p = Test(); |
|
47 | /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' |
47 | /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' |
|
48 | /// } |
48 | /// } |
|
49 | /// </code> |
49 | /// </code> |
|
50 | /// </example> |
50 | /// </example> |
|
51 | [AttributeUsage( |
51 | [AttributeUsage( |
|
52 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | |
52 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | |
|
53 | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | |
53 | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | |
|
54 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] |
54 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] |
|
55 | public sealed class CanBeNullAttribute : Attribute |
55 | public sealed class CanBeNullAttribute : Attribute |
|
56 | { |
56 | { |
|
57 | } |
57 | } |
|
58 | |
58 | |
|
59 | /// <summary> |
59 | /// <summary> |
|
60 | /// Indicates that the value of the marked element can never be <c>null</c>. |
60 | /// Indicates that the value of the marked element can never be <c>null</c>. |
|
61 | /// </summary> |
61 | /// </summary> |
|
62 | /// <example> |
62 | /// <example> |
|
63 | /// <code> |
63 | /// <code> |
|
64 | /// [NotNull] object Foo() { |
64 | /// [NotNull] object Foo() { |
|
65 | /// return null; // Warning: Possible 'null' assignment |
65 | /// return null; // Warning: Possible 'null' assignment |
|
66 | /// } |
66 | /// } |
|
67 | /// </code> |
67 | /// </code> |
|
68 | /// </example> |
68 | /// </example> |
|
69 | [AttributeUsage( |
69 | [AttributeUsage( |
|
70 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | |
70 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | |
|
71 | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | |
71 | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | |
|
72 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] |
72 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] |
|
73 | public sealed class NotNullAttribute : Attribute |
73 | public sealed class NotNullAttribute : Attribute |
|
74 | { |
74 | { |
|
75 | } |
75 | } |
|
76 | |
76 | |
|
77 | /// <summary> |
77 | /// <summary> |
|
78 | /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task |
78 | /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task |
|
79 | /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property |
79 | /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property |
|
80 | /// or of the Lazy.Value property can never be null. |
80 | /// or of the Lazy.Value property can never be null. |
|
81 | /// </summary> |
81 | /// </summary> |
|
82 | /// <example> |
82 | /// <example> |
|
83 | /// <code> |
83 | /// <code> |
|
84 | /// public void Foo([ItemNotNull]List<string> books) |
84 | /// public void Foo([ItemNotNull]List<string> books) |
|
85 | /// { |
85 | /// { |
|
86 | /// foreach (var book in books) { |
86 | /// foreach (var book in books) { |
|
87 | /// if (book != null) // Warning: Expression is always true |
87 | /// if (book != null) // Warning: Expression is always true |
|
88 | /// Console.WriteLine(book.ToUpper()); |
88 | /// Console.WriteLine(book.ToUpper()); |
|
89 | /// } |
89 | /// } |
|
90 | /// } |
90 | /// } |
|
91 | /// </code> |
91 | /// </code> |
|
92 | /// </example> |
92 | /// </example> |
|
93 | [AttributeUsage( |
93 | [AttributeUsage( |
|
94 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | |
94 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | |
|
95 | AttributeTargets.Delegate | AttributeTargets.Field)] |
95 | AttributeTargets.Delegate | AttributeTargets.Field)] |
|
96 | public sealed class ItemNotNullAttribute : Attribute |
96 | public sealed class ItemNotNullAttribute : Attribute |
|
97 | { |
97 | { |
|
98 | } |
98 | } |
|
99 | |
99 | |
|
100 | /// <summary> |
100 | /// <summary> |
|
101 | /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task |
101 | /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task |
|
102 | /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property |
102 | /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property |
|
103 | /// or of the Lazy.Value property can be null. |
103 | /// or of the Lazy.Value property can be null. |
|
104 | /// </summary> |
104 | /// </summary> |
|
105 | /// <example> |
105 | /// <example> |
|
106 | /// <code> |
106 | /// <code> |
|
107 | /// public void Foo([ItemCanBeNull]List<string> books) |
107 | /// public void Foo([ItemCanBeNull]List<string> books) |
|
108 | /// { |
108 | /// { |
|
109 | /// foreach (var book in books) |
109 | /// foreach (var book in books) |
|
110 | /// { |
110 | /// { |
|
111 | /// // Warning: Possible 'System.NullReferenceException' |
111 | /// // Warning: Possible 'System.NullReferenceException' |
|
112 | /// Console.WriteLine(book.ToUpper()); |
112 | /// Console.WriteLine(book.ToUpper()); |
|
113 | /// } |
113 | /// } |
|
114 | /// } |
114 | /// } |
|
115 | /// </code> |
115 | /// </code> |
|
116 | /// </example> |
116 | /// </example> |
|
117 | [AttributeUsage( |
117 | [AttributeUsage( |
|
118 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | |
118 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | |
|
119 | AttributeTargets.Delegate | AttributeTargets.Field)] |
119 | AttributeTargets.Delegate | AttributeTargets.Field)] |
|
120 | public sealed class ItemCanBeNullAttribute : Attribute |
120 | public sealed class ItemCanBeNullAttribute : Attribute |
|
121 | { |
121 | { |
|
122 | } |
122 | } |
|
123 | |
123 | |
|
124 | /// <summary> |
124 | /// <summary> |
|
125 | /// Indicates that the marked method builds string by the format pattern and (optional) arguments. |
125 | /// Indicates that the marked method builds string by the format pattern and (optional) arguments. |
|
126 | /// The parameter, which contains the format string, should be given in constructor. The format string |
126 | /// The parameter, which contains the format string, should be given in constructor. The format string |
|
127 | /// should be in <see cref="string.Format(IFormatProvider,string,object[])" />-like form. |
127 | /// should be in <see cref="string.Format(IFormatProvider,string,object[])" />-like form. |
|
128 | /// </summary> |
128 | /// </summary> |
|
129 | /// <example> |
129 | /// <example> |
|
130 | /// <code> |
130 | /// <code> |
|
131 | /// [StringFormatMethod("message")] |
131 | /// [StringFormatMethod("message")] |
|
132 | /// void ShowError(string message, params object[] args) { /* do something */ } |
132 | /// void ShowError(string message, params object[] args) { /* do something */ } |
|
133 | /// |
133 | /// |
|
134 | /// void Foo() { |
134 | /// void Foo() { |
|
135 | /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string |
135 | /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string |
|
136 | /// } |
136 | /// } |
|
137 | /// </code> |
137 | /// </code> |
|
138 | /// </example> |
138 | /// </example> |
|
139 | [AttributeUsage( |
139 | [AttributeUsage( |
|
140 | AttributeTargets.Constructor | AttributeTargets.Method | |
140 | AttributeTargets.Constructor | AttributeTargets.Method | |
|
141 | AttributeTargets.Property | AttributeTargets.Delegate)] |
141 | AttributeTargets.Property | AttributeTargets.Delegate)] |
|
142 | public sealed class StringFormatMethodAttribute : Attribute |
142 | public sealed class StringFormatMethodAttribute : Attribute |
|
143 | { |
143 | { |
|
144 | #region Public Enums, Properties and Fields |
144 | #region Public Enums, Properties and Fields |
|
145 | |
145 | |
|
146 | [NotNull] |
146 | [NotNull] |
|
147 | public string FormatParameterName { get; } |
147 | public string FormatParameterName { get; } |
|
148 | |
148 | |
|
149 | #endregion |
149 | #endregion |
|
150 | |
150 | |
|
151 | #region Constructors, Destructors and Finalizers |
151 | #region Constructors, Destructors and Finalizers |
|
152 | |
152 | |
|
153 | /// <param name="formatParameterName"> |
153 | /// <param name="formatParameterName"> |
|
154 | /// Specifies which parameter of an annotated method should be treated as the format string |
154 | /// Specifies which parameter of an annotated method should be treated as the format string |
|
155 | /// </param> |
155 | /// </param> |
|
156 | public StringFormatMethodAttribute([NotNull] string formatParameterName) |
156 | public StringFormatMethodAttribute([NotNull] string formatParameterName) |
|
157 | { |
157 | { |
|
158 | FormatParameterName = formatParameterName; |
158 | FormatParameterName = formatParameterName; |
|
159 | } |
159 | } |
|
160 | |
160 | |
|
161 | #endregion |
161 | #endregion |
|
162 | } |
162 | } |
|
163 | |
163 | |
|
164 | /// <summary> |
164 | /// <summary> |
|
165 | /// Use this annotation to specify a type that contains static or const fields |
165 | /// Use this annotation to specify a type that contains static or const fields |
|
166 | /// with values for the annotated property/field/parameter. |
166 | /// with values for the annotated property/field/parameter. |
|
167 | /// The specified type will be used to improve completion suggestions. |
167 | /// The specified type will be used to improve completion suggestions. |
|
168 | /// </summary> |
168 | /// </summary> |
|
169 | /// <example> |
169 | /// <example> |
|
170 | /// <code> |
170 | /// <code> |
|
171 | /// namespace TestNamespace |
171 | /// namespace TestNamespace |
|
172 | /// { |
172 | /// { |
|
173 | /// public class Constants |
173 | /// public class Constants |
|
174 | /// { |
174 | /// { |
|
175 | /// public static int INT_CONST = 1; |
175 | /// public static int INT_CONST = 1; |
|
176 | /// public const string STRING_CONST = "1"; |
176 | /// public const string STRING_CONST = "1"; |
|
177 | /// } |
177 | /// } |
|
178 | /// |
178 | /// |
|
179 | /// public class Class1 |
179 | /// public class Class1 |
|
180 | /// { |
180 | /// { |
|
181 | /// [ValueProvider("TestNamespace.Constants")] public int myField; |
181 | /// [ValueProvider("TestNamespace.Constants")] public int myField; |
|
182 | /// public void Foo([ValueProvider("TestNamespace.Constants")] string str) { } |
182 | /// public void Foo([ValueProvider("TestNamespace.Constants")] string str) { } |
|
183 | /// |
183 | /// |
|
184 | /// public void Test() |
184 | /// public void Test() |
|
185 | /// { |
185 | /// { |
|
186 | /// Foo(/*try completion here*/);// |
186 | /// Foo(/*try completion here*/);// |
|
187 | /// myField = /*try completion here*/ |
187 | /// myField = /*try completion here*/ |
|
188 | /// } |
188 | /// } |
|
189 | /// } |
189 | /// } |
|
190 | /// } |
190 | /// } |
|
191 | /// </code> |
191 | /// </code> |
|
192 | /// </example> |
192 | /// </example> |
|
193 | [AttributeUsage( |
193 | [AttributeUsage( |
|
194 | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field, |
194 | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field, |
|
195 | AllowMultiple = true)] |
195 | AllowMultiple = true)] |
|
196 | public sealed class ValueProviderAttribute : Attribute |
196 | public sealed class ValueProviderAttribute : Attribute |
|
197 | { |
197 | { |
|
198 | #region Public Enums, Properties and Fields |
198 | #region Public Enums, Properties and Fields |
|
199 | |
199 | |
|
200 | [NotNull] |
200 | [NotNull] |
|
201 | public string Name { get; } |
201 | public string Name { get; } |
|
202 | |
202 | |
|
203 | #endregion |
203 | #endregion |
|
204 | |
204 | |
|
205 | #region Constructors, Destructors and Finalizers |
205 | #region Constructors, Destructors and Finalizers |
|
206 | |
206 | |
|
207 | public ValueProviderAttribute([NotNull] string name) |
207 | public ValueProviderAttribute([NotNull] string name) |
|
208 | { |
208 | { |
|
209 | Name = name; |
209 | Name = name; |
|
210 | } |
210 | } |
|
211 | |
211 | |
|
212 | #endregion |
212 | #endregion |
|
213 | } |
213 | } |
|
214 | |
214 | |
|
215 | /// <summary> |
215 | /// <summary> |
|
216 | /// Indicates that the integral value falls into the specified interval. |
216 | /// Indicates that the integral value falls into the specified interval. |
|
217 | /// It's allowed to specify multiple non-intersecting intervals. |
217 | /// It's allowed to specify multiple non-intersecting intervals. |
|
218 | /// Values of interval boundaries are inclusive. |
218 | /// Values of interval boundaries are inclusive. |
|
219 | /// </summary> |
219 | /// </summary> |
|
220 | /// <example> |
220 | /// <example> |
|
221 | /// <code> |
221 | /// <code> |
|
222 | /// void Foo([ValueRange(0, 100)] int value) { |
222 | /// void Foo([ValueRange(0, 100)] int value) { |
|
223 | /// if (value == -1) { // Warning: Expression is always 'false' |
223 | /// if (value == -1) { // Warning: Expression is always 'false' |
|
224 | /// ... |
224 | /// ... |
|
225 | /// } |
225 | /// } |
|
226 | /// } |
226 | /// } |
|
227 | /// </code> |
227 | /// </code> |
|
228 | /// </example> |
228 | /// </example> |
|
229 | [AttributeUsage( |
229 | [AttributeUsage( |
|
230 | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | |
230 | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | |
|
231 | AttributeTargets.Method | AttributeTargets.Delegate, |
231 | AttributeTargets.Method | AttributeTargets.Delegate, |
|
232 | AllowMultiple = true)] |
232 | AllowMultiple = true)] |
|
233 | public sealed class ValueRangeAttribute : Attribute |
233 | public sealed class ValueRangeAttribute : Attribute |
|
234 | { |
234 | { |
|
235 | #region Public Enums, Properties and Fields |
235 | #region Public Enums, Properties and Fields |
|
236 | |
236 | |
|
237 | public object From { get; } |
237 | public object From { get; } |
|
238 | |
238 | |
|
239 | public object To { get; } |
239 | public object To { get; } |
|
240 | |
240 | |
|
241 | #endregion |
241 | #endregion |
|
242 | |
242 | |
|
243 | #region Constructors, Destructors and Finalizers |
243 | #region Constructors, Destructors and Finalizers |
|
244 | |
244 | |
|
245 | public ValueRangeAttribute(long from, long to) |
245 | public ValueRangeAttribute(long from, long to) |
|
246 | { |
246 | { |
|
247 | From = from; |
247 | From = from; |
|
248 | To = to; |
248 | To = to; |
|
249 | } |
249 | } |
|
250 | |
250 | |
|
251 | public ValueRangeAttribute(ulong from, ulong to) |
251 | public ValueRangeAttribute(ulong from, ulong to) |
|
252 | { |
252 | { |
|
253 | From = from; |
253 | From = from; |
|
254 | To = to; |
254 | To = to; |
|
255 | } |
255 | } |
|
256 | |
256 | |
|
257 | public ValueRangeAttribute(long value) |
257 | public ValueRangeAttribute(long value) |
|
258 | { |
258 | { |
|
259 | From = To = value; |
259 | From = To = value; |
|
260 | } |
260 | } |
|
261 | |
261 | |
|
262 | public ValueRangeAttribute(ulong value) |
262 | public ValueRangeAttribute(ulong value) |
|
263 | { |
263 | { |
|
264 | From = To = value; |
264 | From = To = value; |
|
265 | } |
265 | } |
|
266 | |
266 | |
|
267 | #endregion |
267 | #endregion |
|
268 | } |
268 | } |
|
269 | |
269 | |
|
270 | /// <summary> |
270 | /// <summary> |
|
271 | /// Indicates that the integral value never falls below zero. |
271 | /// Indicates that the integral value never falls below zero. |
|
272 | /// </summary> |
272 | /// </summary> |
|
273 | /// <example> |
273 | /// <example> |
|
274 | /// <code> |
274 | /// <code> |
|
275 | /// void Foo([NonNegativeValue] int value) { |
275 | /// void Foo([NonNegativeValue] int value) { |
|
276 | /// if (value == -1) { // Warning: Expression is always 'false' |
276 | /// if (value == -1) { // Warning: Expression is always 'false' |
|
277 | /// ... |
277 | /// ... |
|
278 | /// } |
278 | /// } |
|
279 | /// } |
279 | /// } |
|
280 | /// </code> |
280 | /// </code> |
|
281 | /// </example> |
281 | /// </example> |
|
282 | [AttributeUsage( |
282 | [AttributeUsage( |
|
283 | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | |
283 | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | |
|
284 | AttributeTargets.Method | AttributeTargets.Delegate)] |
284 | AttributeTargets.Method | AttributeTargets.Delegate)] |
|
285 | public sealed class NonNegativeValueAttribute : Attribute |
285 | public sealed class NonNegativeValueAttribute : Attribute |
|
286 | { |
286 | { |
|
287 | } |
287 | } |
|
288 | |
288 | |
|
289 | /// <summary> |
289 | /// <summary> |
|
290 | /// Indicates that the function argument should be a string literal and match one |
290 | /// Indicates that the function argument should be a string literal and match one |
|
291 | /// of the parameters of the caller function. For example, ReSharper annotates |
291 | /// of the parameters of the caller function. For example, ReSharper annotates |
|
292 | /// the parameter of <see cref="System.ArgumentNullException" />. |
292 | /// the parameter of <see cref="System.ArgumentNullException" />. |
|
293 | /// </summary> |
293 | /// </summary> |
|
294 | /// <example> |
294 | /// <example> |
|
295 | /// <code> |
295 | /// <code> |
|
296 | /// void Foo(string param) { |
296 | /// void Foo(string param) { |
|
297 | /// if (param == null) |
297 | /// if (param == null) |
|
298 | /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol |
298 | /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol |
|
299 | /// } |
299 | /// } |
|
300 | /// </code> |
300 | /// </code> |
|
301 | /// </example> |
301 | /// </example> |
|
302 | [AttributeUsage(AttributeTargets.Parameter)] |
302 | [AttributeUsage(AttributeTargets.Parameter)] |
|
303 | public sealed class InvokerParameterNameAttribute : Attribute |
303 | public sealed class InvokerParameterNameAttribute : Attribute |
|
304 | { |
304 | { |
|
305 | } |
305 | } |
|
306 | |
306 | |
|
307 | /// <summary> |
307 | /// <summary> |
|
308 | /// Indicates that the method is contained in a type that implements |
308 | /// Indicates that the method is contained in a type that implements |
|
309 | /// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method |
309 | /// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method |
|
310 | /// is used to notify that some property value changed. |
310 | /// is used to notify that some property value changed. |
|
311 | /// </summary> |
311 | /// </summary> |
|
312 | /// <remarks> |
312 | /// <remarks> |
|
313 | /// The method should be non-static and conform to one of the supported signatures: |
313 | /// The method should be non-static and conform to one of the supported signatures: |
|
314 | /// <list> |
314 | /// <list> |
|
315 | /// <item> |
315 | /// <item> |
|
316 | /// <c>NotifyChanged(string)</c> |
316 | /// <c>NotifyChanged(string)</c> |
|
317 | /// </item> |
317 | /// </item> |
|
318 | /// <item> |
318 | /// <item> |
|
319 | /// <c>NotifyChanged(params string[])</c> |
319 | /// <c>NotifyChanged(params string[])</c> |
|
320 | /// </item> |
320 | /// </item> |
|
321 | /// <item> |
321 | /// <item> |
|
322 | /// <c>NotifyChanged{T}(Expression{Func{T}})</c> |
322 | /// <c>NotifyChanged{T}(Expression{Func{T}})</c> |
|
323 | /// </item> |
323 | /// </item> |
|
324 | /// <item> |
324 | /// <item> |
|
325 | /// <c>NotifyChanged{T,U}(Expression{Func{T,U}})</c> |
325 | /// <c>NotifyChanged{T,U}(Expression{Func{T,U}})</c> |
|
326 | /// </item> |
326 | /// </item> |
|
327 | /// <item> |
327 | /// <item> |
|
328 | /// <c>SetProperty{T}(ref T, T, string)</c> |
328 | /// <c>SetProperty{T}(ref T, T, string)</c> |
|
329 | /// </item> |
329 | /// </item> |
|
330 | /// </list> |
330 | /// </list> |
|
331 | /// </remarks> |
331 | /// </remarks> |
|
332 | /// <example> |
332 | /// <example> |
|
333 | /// <code> |
333 | /// <code> |
|
334 | /// public class Foo : INotifyPropertyChanged { |
334 | /// public class Foo : INotifyPropertyChanged { |
|
335 | /// public event PropertyChangedEventHandler PropertyChanged; |
335 | /// public event PropertyChangedEventHandler PropertyChanged; |
|
336 | /// |
336 | /// |
|
337 | /// [NotifyPropertyChangedInvocator] |
337 | /// [NotifyPropertyChangedInvocator] |
|
338 | /// protected virtual void NotifyChanged(string propertyName) { ... } |
338 | /// protected virtual void NotifyChanged(string propertyName) { ... } |
|
339 | /// |
339 | /// |
|
340 | /// string _name; |
340 | /// string _name; |
|
341 | /// |
341 | /// |
|
342 | /// public string Name { |
342 | /// public string Name { |
|
343 | /// get { return _name; } |
343 | /// get { return _name; } |
|
344 | /// set { _name = value; NotifyChanged("LastName"); /* Warning */ } |
344 | /// set { _name = value; NotifyChanged("LastName"); /* Warning */ } |
|
345 | /// } |
345 | /// } |
|
346 | /// } |
346 | /// } |
|
347 | /// </code> |
347 | /// </code> |
|
348 | /// Examples of generated notifications: |
348 | /// Examples of generated notifications: |
|
349 | /// <list> |
349 | /// <list> |
|
350 | /// <item> |
350 | /// <item> |
|
351 | /// <c>NotifyChanged("Property")</c> |
351 | /// <c>NotifyChanged("Property")</c> |
|
352 | /// </item> |
352 | /// </item> |
|
353 | /// <item> |
353 | /// <item> |
|
354 | /// <c>NotifyChanged(() => Property)</c> |
354 | /// <c>NotifyChanged(() => Property)</c> |
|
355 | /// </item> |
355 | /// </item> |
|
356 | /// <item> |
356 | /// <item> |
|
357 | /// <c>NotifyChanged((VM x) => x.Property)</c> |
357 | /// <c>NotifyChanged((VM x) => x.Property)</c> |
|
358 | /// </item> |
358 | /// </item> |
|
359 | /// <item> |
359 | /// <item> |
|
360 | /// <c>SetProperty(ref myField, value, "Property")</c> |
360 | /// <c>SetProperty(ref myField, value, "Property")</c> |
|
361 | /// </item> |
361 | /// </item> |
|
362 | /// </list> |
362 | /// </list> |
|
363 | /// </example> |
363 | /// </example> |
|
364 | [AttributeUsage(AttributeTargets.Method)] |
364 | [AttributeUsage(AttributeTargets.Method)] |
|
365 | public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute |
365 | public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute |
|
366 | { |
366 | { |
|
367 | #region Public Enums, Properties and Fields |
367 | #region Public Enums, Properties and Fields |
|
368 | |
368 | |
|
369 | [CanBeNull] |
369 | [CanBeNull] |
|
370 | public string ParameterName { get; } |
370 | public string ParameterName { get; } |
|
371 | |
371 | |
|
372 | #endregion |
372 | #endregion |
|
373 | |
373 | |
|
374 | #region Constructors, Destructors and Finalizers |
374 | #region Constructors, Destructors and Finalizers |
|
375 | |
375 | |
|
376 | public NotifyPropertyChangedInvocatorAttribute() |
376 | public NotifyPropertyChangedInvocatorAttribute() |
|
377 | { |
377 | { |
|
378 | } |
378 | } |
|
379 | |
379 | |
|
380 | public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName) |
380 | public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName) |
|
381 | { |
381 | { |
|
382 | ParameterName = parameterName; |
382 | ParameterName = parameterName; |
|
383 | } |
383 | } |
|
384 | |
384 | |
|
385 | #endregion |
385 | #endregion |
|
386 | } |
386 | } |
|
387 | |
387 | |
|
388 | /// <summary> |
388 | /// <summary> |
|
389 | /// Describes dependency between method input and output. |
389 | /// Describes dependency between method input and output. |
|
390 | /// </summary> |
390 | /// </summary> |
|
391 | /// <syntax> |
391 | /// <syntax> |
|
392 | /// <p>Function Definition Table syntax:</p> |
392 | /// <p>Function Definition Table syntax:</p> |
|
393 | /// <list> |
393 | /// <list> |
|
394 | /// <item>FDT ::= FDTRow [;FDTRow]*</item> |
394 | /// <item>FDT ::= FDTRow [;FDTRow]*</item> |
|
395 | /// <item>FDTRow ::= Input => Output | Output <= Input</item> |
395 | /// <item>FDTRow ::= Input => Output | Output <= Input</item> |
|
396 | /// <item>Input ::= ParameterName: Value [, Input]*</item> |
396 | /// <item>Input ::= ParameterName: Value [, Input]*</item> |
|
397 | /// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item> |
397 | /// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item> |
|
398 | /// <item>Value ::= true | false | null | notnull | canbenull</item> |
398 | /// <item>Value ::= true | false | null | notnull | canbenull</item> |
|
399 | /// </list> |
399 | /// </list> |
|
400 | /// If the method has a single input parameter, its name could be omitted.<br /> |
400 | /// If the method has a single input parameter, its name could be omitted.<br /> |
|
401 | /// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same) for the method output |
401 | /// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same) for the method output |
|
402 | /// means that the method doesn't return normally (throws or terminates the process).<br /> |
402 | /// means that the method doesn't return normally (throws or terminates the process).<br /> |
|
403 | /// Value <c>canbenull</c> is only applicable for output parameters.<br /> |
403 | /// Value <c>canbenull</c> is only applicable for output parameters.<br /> |
|
404 | /// You can use multiple <c>[ContractAnnotation]</c> for each FDT row, or use single attribute |
404 | /// You can use multiple <c>[ContractAnnotation]</c> for each FDT row, or use single attribute |
|
405 | /// with rows separated by semicolon. There is no notion of order rows, all rows are checked |
405 | /// with rows separated by semicolon. There is no notion of order rows, all rows are checked |
|
406 | /// for applicability and applied per each program state tracked by the analysis engine.<br /> |
406 | /// for applicability and applied per each program state tracked by the analysis engine.<br /> |
|
407 | /// </syntax> |
407 | /// </syntax> |
|
408 | /// <examples> |
408 | /// <examples> |
|
409 | /// <list> |
409 | /// <list> |
|
410 | /// <item> |
410 | /// <item> |
|
411 | /// <code> |
411 | /// <code> |
|
412 | /// [ContractAnnotation("=> halt")] |
412 | /// [ContractAnnotation("=> halt")] |
|
413 | /// public void TerminationMethod() |
413 | /// public void TerminationMethod() |
|
414 | /// </code> |
414 | /// </code> |
|
415 | /// </item> |
415 | /// </item> |
|
416 | /// <item> |
416 | /// <item> |
|
417 | /// <code> |
417 | /// <code> |
|
418 | /// [ContractAnnotation("null <= param:null")] // reverse condition syntax |
418 | /// [ContractAnnotation("null <= param:null")] // reverse condition syntax |
|
419 | /// public string GetName(string surname) |
419 | /// public string GetName(string surname) |
|
420 | /// </code> |
420 | /// </code> |
|
421 | /// </item> |
421 | /// </item> |
|
422 | /// <item> |
422 | /// <item> |
|
423 | /// <code> |
423 | /// <code> |
|
424 | /// [ContractAnnotation("s:null => true")] |
424 | /// [ContractAnnotation("s:null => true")] |
|
425 | /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() |
425 | /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() |
|
426 | /// </code> |
426 | /// </code> |
|
427 | /// </item> |
427 | /// </item> |
|
428 | /// <item> |
428 | /// <item> |
|
429 | /// <code> |
429 | /// <code> |
|
430 | /// // A method that returns null if the parameter is null, |
430 | /// // A method that returns null if the parameter is null, |
|
431 | /// // and not null if the parameter is not null |
431 | /// // and not null if the parameter is not null |
|
432 | /// [ContractAnnotation("null => null; notnull => notnull")] |
432 | /// [ContractAnnotation("null => null; notnull => notnull")] |
|
433 | /// public object Transform(object data) |
433 | /// public object Transform(object data) |
|
434 | /// </code> |
434 | /// </code> |
|
435 | /// </item> |
435 | /// </item> |
|
436 | /// <item> |
436 | /// <item> |
|
437 | /// <code> |
437 | /// <code> |
|
438 | /// [ContractAnnotation("=> true, result: notnull; => false, result: null")] |
438 | /// [ContractAnnotation("=> true, result: notnull; => false, result: null")] |
|
439 | /// public bool TryParse(string s, out Person result) |
439 | /// public bool TryParse(string s, out Person result) |
|
440 | /// </code> |
440 | /// </code> |
|
441 | /// </item> |
441 | /// </item> |
|
442 | /// </list> |
442 | /// </list> |
|
443 | /// </examples> |
443 | /// </examples> |
|
444 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] |
444 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] |
|
445 | public sealed class ContractAnnotationAttribute : Attribute |
445 | public sealed class ContractAnnotationAttribute : Attribute |
|
446 | { |
446 | { |
|
447 | #region Public Enums, Properties and Fields |
447 | #region Public Enums, Properties and Fields |
|
448 | |
448 | |
|
449 | [NotNull] |
449 | [NotNull] |
|
450 | public string Contract { get; } |
450 | public string Contract { get; } |
|
451 | |
451 | |
|
452 | public bool ForceFullStates { get; } |
452 | public bool ForceFullStates { get; } |
|
453 | |
453 | |
|
454 | #endregion |
454 | #endregion |
|
455 | |
455 | |
|
456 | #region Constructors, Destructors and Finalizers |
456 | #region Constructors, Destructors and Finalizers |
|
457 | |
457 | |
|
458 | public ContractAnnotationAttribute([NotNull] string contract) |
458 | public ContractAnnotationAttribute([NotNull] string contract) |
|
459 | : this(contract, false) |
459 | : this(contract, false) |
|
460 | { |
460 | { |
|
461 | } |
461 | } |
|
462 | |
462 | |
|
463 | public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) |
463 | public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) |
|
464 | { |
464 | { |
|
465 | Contract = contract; |
465 | Contract = contract; |
|
466 | ForceFullStates = forceFullStates; |
466 | ForceFullStates = forceFullStates; |
|
467 | } |
467 | } |
|
468 | |
468 | |
|
469 | #endregion |
469 | #endregion |
|
470 | } |
470 | } |
|
471 | |
471 | |
|
472 | /// <summary> |
472 | /// <summary> |
|
473 | /// Indicates whether the marked element should be localized. |
473 | /// Indicates whether the marked element should be localized. |
|
474 | /// </summary> |
474 | /// </summary> |
|
475 | /// <example> |
475 | /// <example> |
|
476 | /// <code> |
476 | /// <code> |
|
477 | /// [LocalizationRequiredAttribute(true)] |
477 | /// [LocalizationRequiredAttribute(true)] |
|
478 | /// class Foo { |
478 | /// class Foo { |
|
479 | /// string str = "my string"; // Warning: Localizable string |
479 | /// string str = "my string"; // Warning: Localizable string |
|
480 | /// } |
480 | /// } |
|
481 | /// </code> |
481 | /// </code> |
|
482 | /// </example> |
482 | /// </example> |
|
483 | [AttributeUsage(AttributeTargets.All)] |
483 | [AttributeUsage(AttributeTargets.All)] |
|
484 | public sealed class LocalizationRequiredAttribute : Attribute |
484 | public sealed class LocalizationRequiredAttribute : Attribute |
|
485 | { |
485 | { |
|
486 | #region Public Enums, Properties and Fields |
486 | #region Public Enums, Properties and Fields |
|
487 | |
487 | |
|
488 | public bool Required { get; } |
488 | public bool Required { get; } |
|
489 | |
489 | |
|
490 | #endregion |
490 | #endregion |
|
491 | |
491 | |
|
492 | #region Constructors, Destructors and Finalizers |
492 | #region Constructors, Destructors and Finalizers |
|
493 | |
493 | |
|
494 | public LocalizationRequiredAttribute() : this(true) |
494 | public LocalizationRequiredAttribute() : this(true) |
|
495 | { |
495 | { |
|
496 | } |
496 | } |
|
497 | |
497 | |
|
498 | public LocalizationRequiredAttribute(bool required) |
498 | public LocalizationRequiredAttribute(bool required) |
|
499 | { |
499 | { |
|
500 | Required = required; |
500 | Required = required; |
|
501 | } |
501 | } |
|
502 | |
502 | |
|
503 | #endregion |
503 | #endregion |
|
504 | } |
504 | } |
|
505 | |
505 | |
|
506 | /// <summary> |
506 | /// <summary> |
|
507 | /// Indicates that the value of the marked type (or its derivatives) |
507 | /// Indicates that the value of the marked type (or its derivatives) |
|
508 | /// cannot be compared using '==' or '!=' operators and <c>Equals()</c> |
508 | /// cannot be compared using '==' or '!=' operators and <c>Equals()</c> |
|
509 | /// should be used instead. However, using '==' or '!=' for comparison |
509 | /// should be used instead. However, using '==' or '!=' for comparison |
|
510 | /// with <c>null</c> is always permitted. |
510 | /// with <c>null</c> is always permitted. |
|
511 | /// </summary> |
511 | /// </summary> |
|
512 | /// <example> |
512 | /// <example> |
|
513 | /// <code> |
513 | /// <code> |
|
514 | /// [CannotApplyEqualityOperator] |
514 | /// [CannotApplyEqualityOperator] |
|
515 | /// class NoEquality { } |
515 | /// class NoEquality { } |
|
516 | /// |
516 | /// |
|
517 | /// class UsesNoEquality { |
517 | /// class UsesNoEquality { |
|
518 | /// void Test() { |
518 | /// void Test() { |
|
519 | /// var ca1 = new NoEquality(); |
519 | /// var ca1 = new NoEquality(); |
|
520 | /// var ca2 = new NoEquality(); |
520 | /// var ca2 = new NoEquality(); |
|
521 | /// if (ca1 != null) { // OK |
521 | /// if (ca1 != null) { // OK |
|
522 | /// bool condition = ca1 == ca2; // Warning |
522 | /// bool condition = ca1 == ca2; // Warning |
|
523 | /// } |
523 | /// } |
|
524 | /// } |
524 | /// } |
|
525 | /// } |
525 | /// } |
|
526 | /// </code> |
526 | /// </code> |
|
527 | /// </example> |
527 | /// </example> |
|
528 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] |
528 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] |
|
529 | public sealed class CannotApplyEqualityOperatorAttribute : Attribute |
529 | public sealed class CannotApplyEqualityOperatorAttribute : Attribute |
|
530 | { |
530 | { |
|
531 | } |
531 | } |
|
532 | |
532 | |
|
533 | /// <summary> |
533 | /// <summary> |
|
534 | /// When applied to a target attribute, specifies a requirement for any type marked |
534 | /// When applied to a target attribute, specifies a requirement for any type marked |
|
535 | /// with the target attribute to implement or inherit specific type or types. |
535 | /// with the target attribute to implement or inherit specific type or types. |
|
536 | /// </summary> |
536 | /// </summary> |
|
537 | /// <example> |
537 | /// <example> |
|
538 | /// <code> |
538 | /// <code> |
|
539 | /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement |
539 | /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement |
|
540 | /// class ComponentAttribute : Attribute { } |
540 | /// class ComponentAttribute : Attribute { } |
|
541 | /// |
541 | /// |
|
542 | /// [Component] // ComponentAttribute requires implementing IComponent interface |
542 | /// [Component] // ComponentAttribute requires implementing IComponent interface |
|
543 | /// class MyComponent : IComponent { } |
543 | /// class MyComponent : IComponent { } |
|
544 | /// </code> |
544 | /// </code> |
|
545 | /// </example> |
545 | /// </example> |
|
546 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] |
546 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] |
|
547 | [BaseTypeRequired(typeof(Attribute))] |
547 | [BaseTypeRequired(typeof(Attribute))] |
|
548 | public sealed class BaseTypeRequiredAttribute : Attribute |
548 | public sealed class BaseTypeRequiredAttribute : Attribute |
|
549 | { |
549 | { |
|
550 | #region Public Enums, Properties and Fields |
550 | #region Public Enums, Properties and Fields |
|
551 | |
551 | |
|
552 | [NotNull] |
552 | [NotNull] |
|
553 | public Type BaseType { get; } |
553 | public Type BaseType { get; } |
|
554 | |
554 | |
|
555 | #endregion |
555 | #endregion |
|
556 | |
556 | |
|
557 | #region Constructors, Destructors and Finalizers |
557 | #region Constructors, Destructors and Finalizers |
|
558 | |
558 | |
|
559 | public BaseTypeRequiredAttribute([NotNull] Type baseType) |
559 | public BaseTypeRequiredAttribute([NotNull] Type baseType) |
|
560 | { |
560 | { |
|
561 | BaseType = baseType; |
561 | BaseType = baseType; |
|
562 | } |
562 | } |
|
563 | |
563 | |
|
564 | #endregion |
564 | #endregion |
|
565 | } |
565 | } |
|
566 | |
566 | |
|
567 | /// <summary> |
567 | /// <summary> |
|
568 | /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), |
568 | /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), |
|
569 | /// so this symbol will not be reported as unused (as well as by other usage inspections). |
569 | /// so this symbol will not be reported as unused (as well as by other usage inspections). |
|
570 | /// </summary> |
570 | /// </summary> |
|
571 | [AttributeUsage(AttributeTargets.All)] |
571 | [AttributeUsage(AttributeTargets.All)] |
|
572 | public sealed class UsedImplicitlyAttribute : Attribute |
572 | public sealed class UsedImplicitlyAttribute : Attribute |
|
573 | { |
573 | { |
|
574 | #region Public Enums, Properties and Fields |
574 | #region Public Enums, Properties and Fields |
|
575 | |
575 | |
|
576 | public ImplicitUseKindFlags UseKindFlags { get; } |
576 | public ImplicitUseKindFlags UseKindFlags { get; } |
|
577 | |
577 | |
|
578 | public ImplicitUseTargetFlags TargetFlags { get; } |
578 | public ImplicitUseTargetFlags TargetFlags { get; } |
|
579 | |
579 | |
|
580 | #endregion |
580 | #endregion |
|
581 | |
581 | |
|
582 | #region Constructors, Destructors and Finalizers |
582 | #region Constructors, Destructors and Finalizers |
|
583 | |
583 | |
|
584 | public UsedImplicitlyAttribute() |
584 | public UsedImplicitlyAttribute() |
|
585 | : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) |
585 | : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) |
|
586 | { |
586 | { |
|
587 | } |
587 | } |
|
588 | |
588 | |
|
589 | public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) |
589 | public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) |
|
590 | : this(useKindFlags, ImplicitUseTargetFlags.Default) |
590 | : this(useKindFlags, ImplicitUseTargetFlags.Default) |
|
591 | { |
591 | { |
|
592 | } |
592 | } |
|
593 | |
593 | |
|
594 | public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) |
594 | public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) |
|
595 | : this(ImplicitUseKindFlags.Default, targetFlags) |
595 | : this(ImplicitUseKindFlags.Default, targetFlags) |
|
596 | { |
596 | { |
|
597 | } |
597 | } |
|
598 | |
598 | |
|
599 | public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) |
599 | public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) |
|
600 | { |
600 | { |
|
601 | UseKindFlags = useKindFlags; |
601 | UseKindFlags = useKindFlags; |
|
602 | TargetFlags = targetFlags; |
602 | TargetFlags = targetFlags; |
|
603 | } |
603 | } |
|
604 | |
604 | |
|
605 | #endregion |
605 | #endregion |
|
606 | } |
606 | } |
|
607 | |
607 | |
|
608 | /// <summary> |
608 | /// <summary> |
|
609 | /// Can be applied to attributes, type parameters, and parameters of a type assignable from <see cref="System.Type" /> |
609 | /// Can be applied to attributes, type parameters, and parameters of a type assignable from <see cref="System.Type" /> |
|
610 | /// . |
610 | /// . |
|
611 | /// When applied to an attribute, the decorated attribute behaves the same as <see cref="UsedImplicitlyAttribute" />. |
611 | /// When applied to an attribute, the decorated attribute behaves the same as <see cref="UsedImplicitlyAttribute" />. |
|
612 | /// When applied to a type parameter or to a parameter of type <see cref="System.Type" />, indicates that the |
612 | /// When applied to a type parameter or to a parameter of type <see cref="System.Type" />, indicates that the |
|
613 | /// corresponding type |
613 | /// corresponding type |
|
614 | /// is used implicitly. |
614 | /// is used implicitly. |
|
615 | /// </summary> |
615 | /// </summary> |
|
616 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter | AttributeTargets.Parameter)] |
616 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter | AttributeTargets.Parameter)] |
|
617 | public sealed class MeansImplicitUseAttribute : Attribute |
617 | public sealed class MeansImplicitUseAttribute : Attribute |
|
618 | { |
618 | { |
|
619 | #region Public Enums, Properties and Fields |
619 | #region Public Enums, Properties and Fields |
|
620 | |
620 | |
|
621 | [UsedImplicitly] |
621 | [UsedImplicitly] |
|
622 | public ImplicitUseKindFlags UseKindFlags { get; } |
622 | public ImplicitUseKindFlags UseKindFlags { get; } |
|
623 | |
623 | |
|
624 | [UsedImplicitly] |
624 | [UsedImplicitly] |
|
625 | public ImplicitUseTargetFlags TargetFlags { get; } |
625 | public ImplicitUseTargetFlags TargetFlags { get; } |
|
626 | |
626 | |
|
627 | #endregion |
627 | #endregion |
|
628 | |
628 | |
|
629 | #region Constructors, Destructors and Finalizers |
629 | #region Constructors, Destructors and Finalizers |
|
630 | |
630 | |
|
631 | public MeansImplicitUseAttribute() |
631 | public MeansImplicitUseAttribute() |
|
632 | : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) |
632 | : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) |
|
633 | { |
633 | { |
|
634 | } |
634 | } |
|
635 | |
635 | |
|
636 | public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) |
636 | public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) |
|
637 | : this(useKindFlags, ImplicitUseTargetFlags.Default) |
637 | : this(useKindFlags, ImplicitUseTargetFlags.Default) |
|
638 | { |
638 | { |
|
639 | } |
639 | } |
|
640 | |
640 | |
|
641 | public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) |
641 | public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) |
|
642 | : this(ImplicitUseKindFlags.Default, targetFlags) |
642 | : this(ImplicitUseKindFlags.Default, targetFlags) |
|
643 | { |
643 | { |
|
644 | } |
644 | } |
|
645 | |
645 | |
|
646 | public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) |
646 | public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) |
|
647 | { |
647 | { |
|
648 | UseKindFlags = useKindFlags; |
648 | UseKindFlags = useKindFlags; |
|
649 | TargetFlags = targetFlags; |
649 | TargetFlags = targetFlags; |
|
650 | } |
650 | } |
|
651 | |
651 | |
|
652 | #endregion |
652 | #endregion |
|
653 | } |
653 | } |
|
654 | |
654 | |
|
655 | /// <summary> |
655 | /// <summary> |
|
656 | /// Specify the details of implicitly used symbol when it is marked |
656 | /// Specify the details of implicitly used symbol when it is marked |
|
657 | /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />. |
657 | /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />. |
|
658 | /// </summary> |
658 | /// </summary> |
|
659 | [Flags] |
659 | [Flags] |
|
660 | public enum ImplicitUseKindFlags |
660 | public enum ImplicitUseKindFlags |
|
661 | { |
661 | { |
|
662 | Default = Access | Assign | InstantiatedWithFixedConstructorSignature, |
662 | Default = Access | Assign | InstantiatedWithFixedConstructorSignature, |
|
663 | |
663 | |
|
664 | /// <summary>Only entity marked with attribute considered used.</summary> |
664 | /// <summary>Only entity marked with attribute considered used.</summary> |
|
665 | Access = 1, |
665 | Access = 1, |
|
666 | |
666 | |
|
667 | /// <summary>Indicates implicit assignment to a member.</summary> |
667 | /// <summary>Indicates implicit assignment to a member.</summary> |
|
668 | Assign = 2, |
668 | Assign = 2, |
|
669 | |
669 | |
|
670 | /// <summary> |
670 | /// <summary> |
|
671 | /// Indicates implicit instantiation of a type with fixed constructor signature. |
671 | /// Indicates implicit instantiation of a type with fixed constructor signature. |
|
672 | /// That means any unused constructor parameters won't be reported as such. |
672 | /// That means any unused constructor parameters won't be reported as such. |
|
673 | /// </summary> |
673 | /// </summary> |
|
674 | InstantiatedWithFixedConstructorSignature = 4, |
674 | InstantiatedWithFixedConstructorSignature = 4, |
|
675 | |
675 | |
|
676 | /// <summary>Indicates implicit instantiation of a type.</summary> |
676 | /// <summary>Indicates implicit instantiation of a type.</summary> |
|
677 | InstantiatedNoFixedConstructorSignature = 8 |
677 | InstantiatedNoFixedConstructorSignature = 8 |
|
678 | } |
678 | } |
|
679 | |
679 | |
|
680 | /// <summary> |
680 | /// <summary> |
|
681 | /// Specify what is considered to be used implicitly when marked |
681 | /// Specify what is considered to be used implicitly when marked |
|
682 | /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />. |
682 | /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />. |
|
683 | /// </summary> |
683 | /// </summary> |
|
684 | [Flags] |
684 | [Flags] |
|
685 | public enum ImplicitUseTargetFlags |
685 | public enum ImplicitUseTargetFlags |
|
686 | { |
686 | { |
|
687 | Default = Itself, |
687 | Default = Itself, |
|
688 | |
688 | |
|
689 | Itself = 1, |
689 | Itself = 1, |
|
690 | |
690 | |
|
691 | /// <summary>Members of entity marked with attribute are considered used.</summary> |
691 | /// <summary>Members of entity marked with attribute are considered used.</summary> |
|
692 | Members = 2, |
692 | Members = 2, |
|
693 | |
693 | |
|
694 | /// <summary> Inherited entities are considered used. </summary> |
694 | /// <summary> Inherited entities are considered used. </summary> |
|
695 | WithInheritors = 4, |
695 | WithInheritors = 4, |
|
696 | |
696 | |
|
697 | /// <summary>Entity marked with attribute and all its members considered used.</summary> |
697 | /// <summary>Entity marked with attribute and all its members considered used.</summary> |
|
698 | WithMembers = Itself | Members |
698 | WithMembers = Itself | Members |
|
699 | } |
699 | } |
|
700 | |
700 | |
|
701 | /// <summary> |
701 | /// <summary> |
|
702 | /// This attribute is intended to mark publicly available API |
702 | /// This attribute is intended to mark publicly available API |
|
703 | /// which should not be removed and so is treated as used. |
703 | /// which should not be removed and so is treated as used. |
|
704 | /// </summary> |
704 | /// </summary> |
|
705 | [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)] |
705 | [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)] |
|
706 | [AttributeUsage(AttributeTargets.All, Inherited = false)] |
706 | [AttributeUsage(AttributeTargets.All, Inherited = false)] |
|
707 | public sealed class PublicAPIAttribute : Attribute |
707 | public sealed class PublicAPIAttribute : Attribute |
|
708 | { |
708 | { |
|
709 | #region Public Enums, Properties and Fields |
709 | #region Public Enums, Properties and Fields |
|
710 | |
710 | |
|
711 | [CanBeNull] |
711 | [CanBeNull] |
|
712 | public string Comment { get; } |
712 | public string Comment { get; } |
|
713 | |
713 | |
|
714 | #endregion |
714 | #endregion |
|
715 | |
715 | |
|
716 | #region Constructors, Destructors and Finalizers |
716 | #region Constructors, Destructors and Finalizers |
|
717 | |
717 | |
|
718 | public PublicAPIAttribute() |
718 | public PublicAPIAttribute() |
|
719 | { |
719 | { |
|
720 | } |
720 | } |
|
721 | |
721 | |
|
722 | public PublicAPIAttribute([NotNull] string comment) |
722 | public PublicAPIAttribute([NotNull] string comment) |
|
723 | { |
723 | { |
|
724 | Comment = comment; |
724 | Comment = comment; |
|
725 | } |
725 | } |
|
726 | |
726 | |
|
727 | #endregion |
727 | #endregion |
|
728 | } |
728 | } |
|
729 | |
729 | |
|
730 | /// <summary> |
730 | /// <summary> |
|
731 | /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. |
731 | /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. |
|
732 | /// If the parameter is a delegate, indicates that delegate is executed while the method is executed. |
732 | /// If the parameter is a delegate, indicates that delegate is executed while the method is executed. |
|
733 | /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed. |
733 | /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed. |
|
734 | /// </summary> |
734 | /// </summary> |
|
735 | [AttributeUsage(AttributeTargets.Parameter)] |
735 | [AttributeUsage(AttributeTargets.Parameter)] |
|
736 | public sealed class InstantHandleAttribute : Attribute |
736 | public sealed class InstantHandleAttribute : Attribute |
|
737 | { |
737 | { |
|
738 | } |
738 | } |
|
739 | |
739 | |
|
740 | /// <summary> |
740 | /// <summary> |
|
741 | /// Indicates that a method does not make any observable state changes. |
741 | /// Indicates that a method does not make any observable state changes. |
|
742 | /// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>. |
742 | /// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>. |
|
743 | /// </summary> |
743 | /// </summary> |
|
744 | /// <example> |
744 | /// <example> |
|
745 | /// <code> |
745 | /// <code> |
|
746 | /// [Pure] int Multiply(int x, int y) => x * y; |
746 | /// [Pure] int Multiply(int x, int y) => x * y; |
|
747 | /// |
747 | /// |
|
748 | /// void M() { |
748 | /// void M() { |
|
749 | /// Multiply(123, 42); // Warning: Return value of pure method is not used |
749 | /// Multiply(123, 42); // Warning: Return value of pure method is not used |
|
750 | /// } |
750 | /// } |
|
751 | /// </code> |
751 | /// </code> |
|
752 | /// </example> |
752 | /// </example> |
|
753 | [AttributeUsage(AttributeTargets.Method)] |
753 | [AttributeUsage(AttributeTargets.Method)] |
|
754 | public sealed class PureAttribute : Attribute |
754 | public sealed class PureAttribute : Attribute |
|
755 | { |
755 | { |
|
756 | } |
756 | } |
|
757 | |
757 | |
|
758 | /// <summary> |
758 | /// <summary> |
|
759 | /// Indicates that the return value of the method invocation must be used. |
759 | /// Indicates that the return value of the method invocation must be used. |
|
760 | /// </summary> |
760 | /// </summary> |
|
761 | /// <remarks> |
761 | /// <remarks> |
|
762 | /// Methods decorated with this attribute (in contrast to pure methods) might change state, |
762 | /// Methods decorated with this attribute (in contrast to pure methods) might change state, |
|
763 | /// but make no sense without using their return value. <br /> |
763 | /// but make no sense without using their return value. <br /> |
|
764 | /// Similarly to <see cref="PureAttribute" />, this attribute |
764 | /// Similarly to <see cref="PureAttribute" />, this attribute |
|
765 | /// will help detecting usages of the method when the return value in not used. |
765 | /// will help detecting usages of the method when the return value in not used. |
|
766 | /// Additionally, you can optionally specify a custom message, which will be used when showing warnings, e.g. |
766 | /// Additionally, you can optionally specify a custom message, which will be used when showing warnings, e.g. |
|
767 | /// <code>[MustUseReturnValue("Use the return value to...")]</code>. |
767 | /// <code>[MustUseReturnValue("Use the return value to...")]</code>. |
|
768 | /// </remarks> |
768 | /// </remarks> |
|
769 | [AttributeUsage(AttributeTargets.Method)] |
769 | [AttributeUsage(AttributeTargets.Method)] |
|
770 | public sealed class MustUseReturnValueAttribute : Attribute |
770 | public sealed class MustUseReturnValueAttribute : Attribute |
|
771 | { |
771 | { |
|
772 | #region Public Enums, Properties and Fields |
772 | #region Public Enums, Properties and Fields |
|
773 | |
773 | |
|
774 | [CanBeNull] |
774 | [CanBeNull] |
|
775 | public string Justification { get; } |
775 | public string Justification { get; } |
|
776 | |
776 | |
|
777 | #endregion |
777 | #endregion |
|
778 | |
778 | |
|
779 | #region Constructors, Destructors and Finalizers |
779 | #region Constructors, Destructors and Finalizers |
|
780 | |
780 | |
|
781 | public MustUseReturnValueAttribute() |
781 | public MustUseReturnValueAttribute() |
|
782 | { |
782 | { |
|
783 | } |
783 | } |
|
784 | |
784 | |
|
785 | public MustUseReturnValueAttribute([NotNull] string justification) |
785 | public MustUseReturnValueAttribute([NotNull] string justification) |
|
786 | { |
786 | { |
|
787 | Justification = justification; |
787 | Justification = justification; |
|
788 | } |
788 | } |
|
789 | |
789 | |
|
790 | #endregion |
790 | #endregion |
|
791 | } |
791 | } |
|
792 | |
792 | |
|
793 | /// <summary> |
793 | /// <summary> |
|
794 | /// Indicates the type member or parameter of some type, that should be used instead of all other ways |
794 | /// Indicates the type member or parameter of some type, that should be used instead of all other ways |
|
795 | /// to get the value of that type. This annotation is useful when you have some "context" value evaluated |
795 | /// to get the value of that type. This annotation is useful when you have some "context" value evaluated |
|
796 | /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. |
796 | /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. |
|
797 | /// </summary> |
797 | /// </summary> |
|
798 | /// <example> |
798 | /// <example> |
|
799 | /// <code> |
799 | /// <code> |
|
800 | /// class Foo { |
800 | /// class Foo { |
|
801 | /// [ProvidesContext] IBarService _barService = ...; |
801 | /// [ProvidesContext] IBarService _barService = ...; |
|
802 | /// |
802 | /// |
|
803 | /// void ProcessNode(INode node) { |
803 | /// void ProcessNode(INode node) { |
|
804 | /// DoSomething(node, node.GetGlobalServices().Bar); |
804 | /// DoSomething(node, node.GetGlobalServices().Bar); |
|
805 | /// // ^ Warning: use value of '_barService' field |
805 | /// // ^ Warning: use value of '_barService' field |
|
806 | /// } |
806 | /// } |
|
807 | /// } |
807 | /// } |
|
808 | /// </code> |
808 | /// </code> |
|
809 | /// </example> |
809 | /// </example> |
|
810 | [AttributeUsage( |
810 | [AttributeUsage( |
|
811 | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method | |
811 | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method | |
|
812 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | |
812 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | |
|
813 | AttributeTargets.GenericParameter)] |
813 | AttributeTargets.GenericParameter)] |
|
814 | public sealed class ProvidesContextAttribute : Attribute |
814 | public sealed class ProvidesContextAttribute : Attribute |
|
815 | { |
815 | { |
|
816 | } |
816 | } |
|
817 | |
817 | |
|
818 | /// <summary> |
818 | /// <summary> |
|
819 | /// Indicates that a parameter is a path to a file or a folder within a web project. |
819 | /// Indicates that a parameter is a path to a file or a folder within a web project. |
|
820 | /// Path can be relative or absolute, starting from web root (~). |
820 | /// Path can be relative or absolute, starting from web root (~). |
|
821 | /// </summary> |
821 | /// </summary> |
|
822 | [AttributeUsage(AttributeTargets.Parameter)] |
822 | [AttributeUsage(AttributeTargets.Parameter)] |
|
823 | public sealed class PathReferenceAttribute : Attribute |
823 | public sealed class PathReferenceAttribute : Attribute |
|
824 | { |
824 | { |
|
825 | #region Public Enums, Properties and Fields |
825 | #region Public Enums, Properties and Fields |
|
826 | |
826 | |
|
827 | [CanBeNull] |
827 | [CanBeNull] |
|
828 | public string BasePath { get; } |
828 | public string BasePath { get; } |
|
829 | |
829 | |
|
830 | #endregion |
830 | #endregion |
|
831 | |
831 | |
|
832 | #region Constructors, Destructors and Finalizers |
832 | #region Constructors, Destructors and Finalizers |
|
833 | |
833 | |
|
834 | public PathReferenceAttribute() |
834 | public PathReferenceAttribute() |
|
835 | { |
835 | { |
|
836 | } |
836 | } |
|
837 | |
837 | |
|
838 | public PathReferenceAttribute([NotNull] [PathReference] string basePath) |
838 | public PathReferenceAttribute([NotNull] [PathReference] string basePath) |
|
839 | { |
839 | { |
|
840 | BasePath = basePath; |
840 | BasePath = basePath; |
|
841 | } |
841 | } |
|
842 | |
842 | |
|
843 | #endregion |
843 | #endregion |
|
844 | } |
844 | } |
|
845 | |
845 | |
|
846 | /// <summary> |
846 | /// <summary> |
|
847 | /// An extension method marked with this attribute is processed by code completion |
847 | /// An extension method marked with this attribute is processed by code completion |
|
848 | /// as a 'Source Template'. When the extension method is completed over some expression, its source code |
848 | /// as a 'Source Template'. When the extension method is completed over some expression, its source code |
|
849 | /// is automatically expanded like a template at call site. |
849 | /// is automatically expanded like a template at call site. |
|
850 | /// </summary> |
850 | /// </summary> |
|
851 | /// <remarks> |
851 | /// <remarks> |
|
852 | /// Template method body can contain valid source code and/or special comments starting with '$'. |
852 | /// Template method body can contain valid source code and/or special comments starting with '$'. |
|
853 | /// Text inside these comments is added as source code when the template is applied. Template parameters |
853 | /// Text inside these comments is added as source code when the template is applied. Template parameters |
|
854 | /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. |
854 | /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. |
|
855 | /// Use the <see cref="MacroAttribute" /> attribute to specify macros for parameters. |
855 | /// Use the <see cref="MacroAttribute" /> attribute to specify macros for parameters. |
|
856 | /// </remarks> |
856 | /// </remarks> |
|
857 | /// <example> |
857 | /// <example> |
|
858 | /// In this example, the 'forEach' method is a source template available over all values |
858 | /// In this example, the 'forEach' method is a source template available over all values |
|
859 | /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: |
859 | /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: |
|
860 | /// <code> |
860 | /// <code> |
|
861 | /// [SourceTemplate] |
861 | /// [SourceTemplate] |
|
862 | /// public static void forEach<T>(this IEnumerable<T> xs) { |
862 | /// public static void forEach<T>(this IEnumerable<T> xs) { |
|
863 | /// foreach (var x in xs) { |
863 | /// foreach (var x in xs) { |
|
864 | /// //$ $END$ |
864 | /// //$ $END$ |
|
865 | /// } |
865 | /// } |
|
866 | /// } |
866 | /// } |
|
867 | /// </code> |
867 | /// </code> |
|
868 | /// </example> |
868 | /// </example> |
|
869 | [AttributeUsage(AttributeTargets.Method)] |
869 | [AttributeUsage(AttributeTargets.Method)] |
|
870 | public sealed class SourceTemplateAttribute : Attribute |
870 | public sealed class SourceTemplateAttribute : Attribute |
|
871 | { |
871 | { |
|
872 | } |
872 | } |
|
873 | |
873 | |
|
874 | /// <summary> |
874 | /// <summary> |
|
875 | /// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>. |
875 | /// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>. |
|
876 | /// </summary> |
876 | /// </summary> |
|
877 | /// <remarks> |
877 | /// <remarks> |
|
878 | /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression |
878 | /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression |
|
879 | /// is defined in the <see cref="MacroAttribute.Expression" /> property. When applied on a method, the target |
879 | /// is defined in the <see cref="MacroAttribute.Expression" /> property. When applied on a method, the target |
|
880 | /// template parameter is defined in the <see cref="MacroAttribute.Target" /> property. To apply the macro silently |
880 | /// template parameter is defined in the <see cref="MacroAttribute.Target" /> property. To apply the macro silently |
|
881 | /// for the parameter, set the <see cref="MacroAttribute.Editable" /> property value = -1. |
881 | /// for the parameter, set the <see cref="MacroAttribute.Editable" /> property value = -1. |
|
882 | /// </remarks> |
882 | /// </remarks> |
|
883 | /// <example> |
883 | /// <example> |
|
884 | /// Applying the attribute on a source template method: |
884 | /// Applying the attribute on a source template method: |
|
885 | /// <code> |
885 | /// <code> |
|
886 | /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] |
886 | /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] |
|
887 | /// public static void forEach<T>(this IEnumerable<T> collection) { |
887 | /// public static void forEach<T>(this IEnumerable<T> collection) { |
|
888 | /// foreach (var item in collection) { |
888 | /// foreach (var item in collection) { |
|
889 | /// //$ $END$ |
889 | /// //$ $END$ |
|
890 | /// } |
890 | /// } |
|
891 | /// } |
891 | /// } |
|
892 | /// </code> |
892 | /// </code> |
|
893 | /// Applying the attribute on a template method parameter: |
893 | /// Applying the attribute on a template method parameter: |
|
894 | /// <code> |
894 | /// <code> |
|
895 | /// [SourceTemplate] |
895 | /// [SourceTemplate] |
|
896 | /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { |
896 | /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { |
|
897 | /// /*$ var $x$Id = "$newguid$" + x.ToString(); |
897 | /// /*$ var $x$Id = "$newguid$" + x.ToString(); |
|
898 | /// x.DoSomething($x$Id); */ |
898 | /// x.DoSomething($x$Id); */ |
|
899 | /// } |
899 | /// } |
|
900 | /// </code> |
900 | /// </code> |
|
901 | /// </example> |
901 | /// </example> |
|
902 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)] |
902 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)] |
|
903 | public sealed class MacroAttribute : Attribute |
903 | public sealed class MacroAttribute : Attribute |
|
904 | { |
904 | { |
|
905 | #region Public Enums, Properties and Fields |
905 | #region Public Enums, Properties and Fields |
|
906 | |
906 | |
|
907 | /// <summary> |
907 | /// <summary> |
|
908 | /// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see> |
908 | /// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see> |
|
909 | /// parameter when the template is expanded. |
909 | /// parameter when the template is expanded. |
|
910 | /// </summary> |
910 | /// </summary> |
|
911 | [CanBeNull] |
911 | [CanBeNull] |
|
912 | public string Expression { get; set; } |
912 | public string Expression { get; set; } |
|
913 | |
913 | |
|
914 | /// <summary> |
914 | /// <summary> |
|
915 | /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. |
915 | /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. |
|
916 | /// </summary> |
916 | /// </summary> |
|
917 | /// <remarks> |
917 | /// <remarks> |
|
918 | /// If the target parameter is used several times in the template, only one occurrence becomes editable; |
918 | /// If the target parameter is used several times in the template, only one occurrence becomes editable; |
|
919 | /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, |
919 | /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, |
|
920 | /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1. |
920 | /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1. |
|
921 | /// </remarks> |
921 | /// </remarks> |
|
922 | public int Editable { get; set; } |
922 | public int Editable { get; set; } |
|
923 | |
923 | |
|
924 | /// <summary> |
924 | /// <summary> |
|
925 | /// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the |
925 | /// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the |
|
926 | /// <see cref="MacroAttribute" /> is applied on a template method. |
926 | /// <see cref="MacroAttribute" /> is applied on a template method. |
|
927 | /// </summary> |
927 | /// </summary> |
|
928 | [CanBeNull] |
928 | [CanBeNull] |
|
929 | public string Target { get; set; } |
929 | public string Target { get; set; } |
|
930 | |
930 | |
|
931 | #endregion |
931 | #endregion |
|
932 | } |
932 | } |
|
933 | |
933 | |
|
934 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
934 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
|
935 | AllowMultiple = true)] |
935 | AllowMultiple = true)] |
|
936 | public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute |
936 | public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute |
|
937 | { |
937 | { |
|
938 | #region Public Enums, Properties and Fields |
938 | #region Public Enums, Properties and Fields |
|
939 | |
939 | |
|
940 | [NotNull] |
940 | [NotNull] |
|
941 | public string Format { get; } |
941 | public string Format { get; } |
|
942 | |
942 | |
|
943 | #endregion |
943 | #endregion |
|
944 | |
944 | |
|
945 | #region Constructors, Destructors and Finalizers |
945 | #region Constructors, Destructors and Finalizers |
|
946 | |
946 | |
|
947 | public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format) |
947 | public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format) |
|
948 | { |
948 | { |
|
949 | Format = format; |
949 | Format = format; |
|
950 | } |
950 | } |
|
951 | |
951 | |
|
952 | #endregion |
952 | #endregion |
|
953 | } |
953 | } |
|
954 | |
954 | |
|
955 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
955 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
|
956 | AllowMultiple = true)] |
956 | AllowMultiple = true)] |
|
957 | public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute |
957 | public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute |
|
958 | { |
958 | { |
|
959 | #region Public Enums, Properties and Fields |
959 | #region Public Enums, Properties and Fields |
|
960 | |
960 | |
|
961 | [NotNull] |
961 | [NotNull] |
|
962 | public string Format { get; } |
962 | public string Format { get; } |
|
963 | |
963 | |
|
964 | #endregion |
964 | #endregion |
|
965 | |
965 | |
|
966 | #region Constructors, Destructors and Finalizers |
966 | #region Constructors, Destructors and Finalizers |
|
967 | |
967 | |
|
968 | public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format) |
968 | public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format) |
|
969 | { |
969 | { |
|
970 | Format = format; |
970 | Format = format; |
|
971 | } |
971 | } |
|
972 | |
972 | |
|
973 | #endregion |
973 | #endregion |
|
974 | } |
974 | } |
|
975 | |
975 | |
|
976 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
976 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
|
977 | AllowMultiple = true)] |
977 | AllowMultiple = true)] |
|
978 | public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute |
978 | public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute |
|
979 | { |
979 | { |
|
980 | #region Public Enums, Properties and Fields |
980 | #region Public Enums, Properties and Fields |
|
981 | |
981 | |
|
982 | [NotNull] |
982 | [NotNull] |
|
983 | public string Format { get; } |
983 | public string Format { get; } |
|
984 | |
984 | |
|
985 | #endregion |
985 | #endregion |
|
986 | |
986 | |
|
987 | #region Constructors, Destructors and Finalizers |
987 | #region Constructors, Destructors and Finalizers |
|
988 | |
988 | |
|
989 | public AspMvcAreaViewLocationFormatAttribute([NotNull] string format) |
989 | public AspMvcAreaViewLocationFormatAttribute([NotNull] string format) |
|
990 | { |
990 | { |
|
991 | Format = format; |
991 | Format = format; |
|
992 | } |
992 | } |
|
993 | |
993 | |
|
994 | #endregion |
994 | #endregion |
|
995 | } |
995 | } |
|
996 | |
996 | |
|
997 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
997 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
|
998 | AllowMultiple = true)] |
998 | AllowMultiple = true)] |
|
999 | public sealed class AspMvcMasterLocationFormatAttribute : Attribute |
999 | public sealed class AspMvcMasterLocationFormatAttribute : Attribute |
|
1000 | { |
1000 | { |
|
1001 | #region Public Enums, Properties and Fields |
1001 | #region Public Enums, Properties and Fields |
|
1002 | |
1002 | |
|
1003 | [NotNull] |
1003 | [NotNull] |
|
1004 | public string Format { get; } |
1004 | public string Format { get; } |
|
1005 | |
1005 | |
|
1006 | #endregion |
1006 | #endregion |
|
1007 | |
1007 | |
|
1008 | #region Constructors, Destructors and Finalizers |
1008 | #region Constructors, Destructors and Finalizers |
|
1009 | |
1009 | |
|
1010 | public AspMvcMasterLocationFormatAttribute([NotNull] string format) |
1010 | public AspMvcMasterLocationFormatAttribute([NotNull] string format) |
|
1011 | { |
1011 | { |
|
1012 | Format = format; |
1012 | Format = format; |
|
1013 | } |
1013 | } |
|
1014 | |
1014 | |
|
1015 | #endregion |
1015 | #endregion |
|
1016 | } |
1016 | } |
|
1017 | |
1017 | |
|
1018 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
1018 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
|
1019 | AllowMultiple = true)] |
1019 | AllowMultiple = true)] |
|
1020 | public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute |
1020 | public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute |
|
1021 | { |
1021 | { |
|
1022 | #region Public Enums, Properties and Fields |
1022 | #region Public Enums, Properties and Fields |
|
1023 | |
1023 | |
|
1024 | [NotNull] |
1024 | [NotNull] |
|
1025 | public string Format { get; } |
1025 | public string Format { get; } |
|
1026 | |
1026 | |
|
1027 | #endregion |
1027 | #endregion |
|
1028 | |
1028 | |
|
1029 | #region Constructors, Destructors and Finalizers |
1029 | #region Constructors, Destructors and Finalizers |
|
1030 | |
1030 | |
|
1031 | public AspMvcPartialViewLocationFormatAttribute([NotNull] string format) |
1031 | public AspMvcPartialViewLocationFormatAttribute([NotNull] string format) |
|
1032 | { |
1032 | { |
|
1033 | Format = format; |
1033 | Format = format; |
|
1034 | } |
1034 | } |
|
1035 | |
1035 | |
|
1036 | #endregion |
1036 | #endregion |
|
1037 | } |
1037 | } |
|
1038 | |
1038 | |
|
1039 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
1039 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, |
|
1040 | AllowMultiple = true)] |
1040 | AllowMultiple = true)] |
|
1041 | public sealed class AspMvcViewLocationFormatAttribute : Attribute |
1041 | public sealed class AspMvcViewLocationFormatAttribute : Attribute |
|
1042 | { |
1042 | { |
|
1043 | #region Public Enums, Properties and Fields |
1043 | #region Public Enums, Properties and Fields |
|
1044 | |
1044 | |
|
1045 | [NotNull] |
1045 | [NotNull] |
|
1046 | public string Format { get; } |
1046 | public string Format { get; } |
|
1047 | |
1047 | |
|
1048 | #endregion |
1048 | #endregion |
|
1049 | |
1049 | |
|
1050 | #region Constructors, Destructors and Finalizers |
1050 | #region Constructors, Destructors and Finalizers |
|
1051 | |
1051 | |
|
1052 | public AspMvcViewLocationFormatAttribute([NotNull] string format) |
1052 | public AspMvcViewLocationFormatAttribute([NotNull] string format) |
|
1053 | { |
1053 | { |
|
1054 | Format = format; |
1054 | Format = format; |
|
1055 | } |
1055 | } |
|
1056 | |
1056 | |
|
1057 | #endregion |
1057 | #endregion |
|
1058 | } |
1058 | } |
|
1059 | |
1059 | |
|
1060 | /// <summary> |
1060 | /// <summary> |
|
1061 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter |
1061 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter |
|
1062 | /// is an MVC action. If applied to a method, the MVC action name is calculated |
1062 | /// is an MVC action. If applied to a method, the MVC action name is calculated |
|
1063 | /// implicitly from the context. Use this attribute for custom wrappers similar to |
1063 | /// implicitly from the context. Use this attribute for custom wrappers similar to |
|
1064 | /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>. |
1064 | /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>. |
|
1065 | /// </summary> |
1065 | /// </summary> |
|
1066 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
1066 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
|
1067 | AttributeTargets.Property)] |
1067 | AttributeTargets.Property)] |
|
1068 | public sealed class AspMvcActionAttribute : Attribute |
1068 | public sealed class AspMvcActionAttribute : Attribute |
|
1069 | { |
1069 | { |
|
1070 | #region Public Enums, Properties and Fields |
1070 | #region Public Enums, Properties and Fields |
|
1071 | |
1071 | |
|
1072 | [CanBeNull] |
1072 | [CanBeNull] |
|
1073 | public string AnonymousProperty { get; } |
1073 | public string AnonymousProperty { get; } |
|
1074 | |
1074 | |
|
1075 | #endregion |
1075 | #endregion |
|
1076 | |
1076 | |
|
1077 | #region Constructors, Destructors and Finalizers |
1077 | #region Constructors, Destructors and Finalizers |
|
1078 | |
1078 | |
|
1079 | public AspMvcActionAttribute() |
1079 | public AspMvcActionAttribute() |
|
1080 | { |
1080 | { |
|
1081 | } |
1081 | } |
|
1082 | |
1082 | |
|
1083 | public AspMvcActionAttribute([NotNull] string anonymousProperty) |
1083 | public AspMvcActionAttribute([NotNull] string anonymousProperty) |
|
1084 | { |
1084 | { |
|
1085 | AnonymousProperty = anonymousProperty; |
1085 | AnonymousProperty = anonymousProperty; |
|
1086 | } |
1086 | } |
|
1087 | |
1087 | |
|
1088 | #endregion |
1088 | #endregion |
|
1089 | } |
1089 | } |
|
1090 | |
1090 | |
|
1091 | /// <summary> |
1091 | /// <summary> |
|
1092 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC area. |
1092 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC area. |
|
1093 | /// Use this attribute for custom wrappers similar to |
1093 | /// Use this attribute for custom wrappers similar to |
|
1094 | /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>. |
1094 | /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>. |
|
1095 | /// </summary> |
1095 | /// </summary> |
|
1096 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
1096 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
|
1097 | public sealed class AspMvcAreaAttribute : Attribute |
1097 | public sealed class AspMvcAreaAttribute : Attribute |
|
1098 | { |
1098 | { |
|
1099 | #region Public Enums, Properties and Fields |
1099 | #region Public Enums, Properties and Fields |
|
1100 | |
1100 | |
|
1101 | [CanBeNull] |
1101 | [CanBeNull] |
|
1102 | public string AnonymousProperty { get; } |
1102 | public string AnonymousProperty { get; } |
|
1103 | |
1103 | |
|
1104 | #endregion |
1104 | #endregion |
|
1105 | |
1105 | |
|
1106 | #region Constructors, Destructors and Finalizers |
1106 | #region Constructors, Destructors and Finalizers |
|
1107 | |
1107 | |
|
1108 | public AspMvcAreaAttribute() |
1108 | public AspMvcAreaAttribute() |
|
1109 | { |
1109 | { |
|
1110 | } |
1110 | } |
|
1111 | |
1111 | |
|
1112 | public AspMvcAreaAttribute([NotNull] string anonymousProperty) |
1112 | public AspMvcAreaAttribute([NotNull] string anonymousProperty) |
|
1113 | { |
1113 | { |
|
1114 | AnonymousProperty = anonymousProperty; |
1114 | AnonymousProperty = anonymousProperty; |
|
1115 | } |
1115 | } |
|
1116 | |
1116 | |
|
1117 | #endregion |
1117 | #endregion |
|
1118 | } |
1118 | } |
|
1119 | |
1119 | |
|
1120 | /// <summary> |
1120 | /// <summary> |
|
1121 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is |
1121 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is |
|
1122 | /// an MVC controller. If applied to a method, the MVC controller name is calculated |
1122 | /// an MVC controller. If applied to a method, the MVC controller name is calculated |
|
1123 | /// implicitly from the context. Use this attribute for custom wrappers similar to |
1123 | /// implicitly from the context. Use this attribute for custom wrappers similar to |
|
1124 | /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>. |
1124 | /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>. |
|
1125 | /// </summary> |
1125 | /// </summary> |
|
1126 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
1126 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
|
1127 | AttributeTargets.Property)] |
1127 | AttributeTargets.Property)] |
|
1128 | public sealed class AspMvcControllerAttribute : Attribute |
1128 | public sealed class AspMvcControllerAttribute : Attribute |
|
1129 | { |
1129 | { |
|
1130 | #region Public Enums, Properties and Fields |
1130 | #region Public Enums, Properties and Fields |
|
1131 | |
1131 | |
|
1132 | [CanBeNull] |
1132 | [CanBeNull] |
|
1133 | public string AnonymousProperty { get; } |
1133 | public string AnonymousProperty { get; } |
|
1134 | |
1134 | |
|
1135 | #endregion |
1135 | #endregion |
|
1136 | |
1136 | |
|
1137 | #region Constructors, Destructors and Finalizers |
1137 | #region Constructors, Destructors and Finalizers |
|
1138 | |
1138 | |
|
1139 | public AspMvcControllerAttribute() |
1139 | public AspMvcControllerAttribute() |
|
1140 | { |
1140 | { |
|
1141 | } |
1141 | } |
|
1142 | |
1142 | |
|
1143 | public AspMvcControllerAttribute([NotNull] string anonymousProperty) |
1143 | public AspMvcControllerAttribute([NotNull] string anonymousProperty) |
|
1144 | { |
1144 | { |
|
1145 | AnonymousProperty = anonymousProperty; |
1145 | AnonymousProperty = anonymousProperty; |
|
1146 | } |
1146 | } |
|
1147 | |
1147 | |
|
1148 | #endregion |
1148 | #endregion |
|
1149 | } |
1149 | } |
|
1150 | |
1150 | |
|
1151 | /// <summary> |
1151 | /// <summary> |
|
1152 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC Master. Use this attribute |
1152 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC Master. Use this attribute |
|
1153 | /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>. |
1153 | /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>. |
|
1154 | /// </summary> |
1154 | /// </summary> |
|
1155 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
1155 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
|
1156 | public sealed class AspMvcMasterAttribute : Attribute |
1156 | public sealed class AspMvcMasterAttribute : Attribute |
|
1157 | { |
1157 | { |
|
1158 | } |
1158 | } |
|
1159 | |
1159 | |
|
1160 | /// <summary> |
1160 | /// <summary> |
|
1161 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC model type. Use this attribute |
1161 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC model type. Use this attribute |
|
1162 | /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>. |
1162 | /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>. |
|
1163 | /// </summary> |
1163 | /// </summary> |
|
1164 | [AttributeUsage(AttributeTargets.Parameter)] |
1164 | [AttributeUsage(AttributeTargets.Parameter)] |
|
1165 | public sealed class AspMvcModelTypeAttribute : Attribute |
1165 | public sealed class AspMvcModelTypeAttribute : Attribute |
|
1166 | { |
1166 | { |
|
1167 | } |
1167 | } |
|
1168 | |
1168 | |
|
1169 | /// <summary> |
1169 | /// <summary> |
|
1170 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC |
1170 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC |
|
1171 | /// partial view. If applied to a method, the MVC partial view name is calculated implicitly |
1171 | /// partial view. If applied to a method, the MVC partial view name is calculated implicitly |
|
1172 | /// from the context. Use this attribute for custom wrappers similar to |
1172 | /// from the context. Use this attribute for custom wrappers similar to |
|
1173 | /// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>. |
1173 | /// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>. |
|
1174 | /// </summary> |
1174 | /// </summary> |
|
1175 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
1175 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
|
1176 | AttributeTargets.Property)] |
1176 | AttributeTargets.Property)] |
|
1177 | public sealed class AspMvcPartialViewAttribute : Attribute |
1177 | public sealed class AspMvcPartialViewAttribute : Attribute |
|
1178 | { |
1178 | { |
|
1179 | } |
1179 | } |
|
1180 | |
1180 | |
|
1181 | /// <summary> |
1181 | /// <summary> |
|
1182 | /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. |
1182 | /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. |
|
1183 | /// </summary> |
1183 | /// </summary> |
|
1184 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] |
1184 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] |
|
1185 | public sealed class AspMvcSuppressViewErrorAttribute : Attribute |
1185 | public sealed class AspMvcSuppressViewErrorAttribute : Attribute |
|
1186 | { |
1186 | { |
|
1187 | } |
1187 | } |
|
1188 | |
1188 | |
|
1189 | /// <summary> |
1189 | /// <summary> |
|
1190 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. |
1190 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. |
|
1191 | /// Use this attribute for custom wrappers similar to |
1191 | /// Use this attribute for custom wrappers similar to |
|
1192 | /// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>. |
1192 | /// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>. |
|
1193 | /// </summary> |
1193 | /// </summary> |
|
1194 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
1194 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
|
1195 | public sealed class AspMvcDisplayTemplateAttribute : Attribute |
1195 | public sealed class AspMvcDisplayTemplateAttribute : Attribute |
|
1196 | { |
1196 | { |
|
1197 | } |
1197 | } |
|
1198 | |
1198 | |
|
1199 | /// <summary> |
1199 | /// <summary> |
|
1200 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC editor template. |
1200 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC editor template. |
|
1201 | /// Use this attribute for custom wrappers similar to |
1201 | /// Use this attribute for custom wrappers similar to |
|
1202 | /// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>. |
1202 | /// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>. |
|
1203 | /// </summary> |
1203 | /// </summary> |
|
1204 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
1204 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
|
1205 | public sealed class AspMvcEditorTemplateAttribute : Attribute |
1205 | public sealed class AspMvcEditorTemplateAttribute : Attribute |
|
1206 | { |
1206 | { |
|
1207 | } |
1207 | } |
|
1208 | |
1208 | |
|
1209 | /// <summary> |
1209 | /// <summary> |
|
1210 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC template. |
1210 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC template. |
|
1211 | /// Use this attribute for custom wrappers similar to |
1211 | /// Use this attribute for custom wrappers similar to |
|
1212 | /// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>. |
1212 | /// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>. |
|
1213 | /// </summary> |
1213 | /// </summary> |
|
1214 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
1214 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
|
1215 | public sealed class AspMvcTemplateAttribute : Attribute |
1215 | public sealed class AspMvcTemplateAttribute : Attribute |
|
1216 | { |
1216 | { |
|
1217 | } |
1217 | } |
|
1218 | |
1218 | |
|
1219 | /// <summary> |
1219 | /// <summary> |
|
1220 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter |
1220 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter |
|
1221 | /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly |
1221 | /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly |
|
1222 | /// from the context. Use this attribute for custom wrappers similar to |
1222 | /// from the context. Use this attribute for custom wrappers similar to |
|
1223 | /// <c>System.Web.Mvc.Controller.View(Object)</c>. |
1223 | /// <c>System.Web.Mvc.Controller.View(Object)</c>. |
|
1224 | /// </summary> |
1224 | /// </summary> |
|
1225 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
1225 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
|
1226 | AttributeTargets.Property)] |
1226 | AttributeTargets.Property)] |
|
1227 | public sealed class AspMvcViewAttribute : Attribute |
1227 | public sealed class AspMvcViewAttribute : Attribute |
|
1228 | { |
1228 | { |
|
1229 | } |
1229 | } |
|
1230 | |
1230 | |
|
1231 | /// <summary> |
1231 | /// <summary> |
|
1232 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter |
1232 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter |
|
1233 | /// is an MVC view component name. |
1233 | /// is an MVC view component name. |
|
1234 | /// </summary> |
1234 | /// </summary> |
|
1235 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
1235 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
|
1236 | public sealed class AspMvcViewComponentAttribute : Attribute |
1236 | public sealed class AspMvcViewComponentAttribute : Attribute |
|
1237 | { |
1237 | { |
|
1238 | } |
1238 | } |
|
1239 | |
1239 | |
|
1240 | /// <summary> |
1240 | /// <summary> |
|
1241 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter |
1241 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter |
|
1242 | /// is an MVC view component view. If applied to a method, the MVC view component view name is default. |
1242 | /// is an MVC view component view. If applied to a method, the MVC view component view name is default. |
|
1243 | /// </summary> |
1243 | /// </summary> |
|
1244 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
1244 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | |
|
1245 | AttributeTargets.Property)] |
1245 | AttributeTargets.Property)] |
|
1246 | public sealed class AspMvcViewComponentViewAttribute : Attribute |
1246 | public sealed class AspMvcViewComponentViewAttribute : Attribute |
|
1247 | { |
1247 | { |
|
1248 | } |
1248 | } |
|
1249 | |
1249 | |
|
1250 | /// <summary> |
1250 | /// <summary> |
|
1251 | /// ASP.NET MVC attribute. When applied to a parameter of an attribute, |
1251 | /// ASP.NET MVC attribute. When applied to a parameter of an attribute, |
|
1252 | /// indicates that this parameter is an MVC action name. |
1252 | /// indicates that this parameter is an MVC action name. |
|
1253 | /// </summary> |
1253 | /// </summary> |
|
1254 | /// <example> |
1254 | /// <example> |
|
1255 | /// <code> |
1255 | /// <code> |
|
1256 | /// [ActionName("Foo")] |
1256 | /// [ActionName("Foo")] |
|
1257 | /// public ActionResult Login(string returnUrl) { |
1257 | /// public ActionResult Login(string returnUrl) { |
|
1258 | /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK |
1258 | /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK |
|
1259 | /// return RedirectToAction("Bar"); // Error: Cannot resolve action |
1259 | /// return RedirectToAction("Bar"); // Error: Cannot resolve action |
|
1260 | /// } |
1260 | /// } |
|
1261 | /// </code> |
1261 | /// </code> |
|
1262 | /// </example> |
1262 | /// </example> |
|
1263 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] |
1263 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] |
|
1264 | public sealed class AspMvcActionSelectorAttribute : Attribute |
1264 | public sealed class AspMvcActionSelectorAttribute : Attribute |
|
1265 | { |
1265 | { |
|
1266 | } |
1266 | } |
|
1267 | |
1267 | |
|
1268 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] |
1268 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] |
|
1269 | public sealed class HtmlElementAttributesAttribute : Attribute |
1269 | public sealed class HtmlElementAttributesAttribute : Attribute |
|
1270 | { |
1270 | { |
|
1271 | #region Public Enums, Properties and Fields |
1271 | #region Public Enums, Properties and Fields |
|
1272 | |
1272 | |
|
1273 | [CanBeNull] |
1273 | [CanBeNull] |
|
1274 | public string Name { get; } |
1274 | public string Name { get; } |
|
1275 | |
1275 | |
|
1276 | #endregion |
1276 | #endregion |
|
1277 | |
1277 | |
|
1278 | #region Constructors, Destructors and Finalizers |
1278 | #region Constructors, Destructors and Finalizers |
|
1279 | |
1279 | |
|
1280 | public HtmlElementAttributesAttribute() |
1280 | public HtmlElementAttributesAttribute() |
|
1281 | { |
1281 | { |
|
1282 | } |
1282 | } |
|
1283 | |
1283 | |
|
1284 | public HtmlElementAttributesAttribute([NotNull] string name) |
1284 | public HtmlElementAttributesAttribute([NotNull] string name) |
|
1285 | { |
1285 | { |
|
1286 | Name = name; |
1286 | Name = name; |
|
1287 | } |
1287 | } |
|
1288 | |
1288 | |
|
1289 | #endregion |
1289 | #endregion |
|
1290 | } |
1290 | } |
|
1291 | |
1291 | |
|
1292 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
1292 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
|
1293 | public sealed class HtmlAttributeValueAttribute : Attribute |
1293 | public sealed class HtmlAttributeValueAttribute : Attribute |
|
1294 | { |
1294 | { |
|
1295 | #region Public Enums, Properties and Fields |
1295 | #region Public Enums, Properties and Fields |
|
1296 | |
1296 | |
|
1297 | [NotNull] |
1297 | [NotNull] |
|
1298 | public string Name { get; } |
1298 | public string Name { get; } |
|
1299 | |
1299 | |
|
1300 | #endregion |
1300 | #endregion |
|
1301 | |
1301 | |
|
1302 | #region Constructors, Destructors and Finalizers |
1302 | #region Constructors, Destructors and Finalizers |
|
1303 | |
1303 | |
|
1304 | public HtmlAttributeValueAttribute([NotNull] string name) |
1304 | public HtmlAttributeValueAttribute([NotNull] string name) |
|
1305 | { |
1305 | { |
|
1306 | Name = name; |
1306 | Name = name; |
|
1307 | } |
1307 | } |
|
1308 | |
1308 | |
|
1309 | #endregion |
1309 | #endregion |
|
1310 | } |
1310 | } |
|
1311 | |
1311 | |
|
1312 | /// <summary> |
1312 | /// <summary> |
|
1313 | /// Razor attribute. Indicates that the marked parameter or method is a Razor section. |
1313 | /// Razor attribute. Indicates that the marked parameter or method is a Razor section. |
|
1314 | /// Use this attribute for custom wrappers similar to |
1314 | /// Use this attribute for custom wrappers similar to |
|
1315 | /// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>. |
1315 | /// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>. |
|
1316 | /// </summary> |
1316 | /// </summary> |
|
1317 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] |
1317 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] |
|
1318 | public sealed class RazorSectionAttribute : Attribute |
1318 | public sealed class RazorSectionAttribute : Attribute |
|
1319 | { |
1319 | { |
|
1320 | } |
1320 | } |
|
1321 | |
1321 | |
|
1322 | /// <summary> |
1322 | /// <summary> |
|
1323 | /// Indicates how method, constructor invocation, or property access |
1323 | /// Indicates how method, constructor invocation, or property access |
|
1324 | /// over collection type affects the contents of the collection. |
1324 | /// over collection type affects the contents of the collection. |
|
1325 | /// Use <see cref="CollectionAccessType" /> to specify the access type. |
1325 | /// Use <see cref="CollectionAccessType" /> to specify the access type. |
|
1326 | /// </summary> |
1326 | /// </summary> |
|
1327 | /// <remarks> |
1327 | /// <remarks> |
|
1328 | /// Using this attribute only makes sense if all collection methods are marked with this attribute. |
1328 | /// Using this attribute only makes sense if all collection methods are marked with this attribute. |
|
1329 | /// </remarks> |
1329 | /// </remarks> |
|
1330 | /// <example> |
1330 | /// <example> |
|
1331 | /// <code> |
1331 | /// <code> |
|
1332 | /// public class MyStringCollection : List<string> |
1332 | /// public class MyStringCollection : List<string> |
|
1333 | /// { |
1333 | /// { |
|
1334 | /// [CollectionAccess(CollectionAccessType.Read)] |
1334 | /// [CollectionAccess(CollectionAccessType.Read)] |
|
1335 | /// public string GetFirstString() |
1335 | /// public string GetFirstString() |
|
1336 | /// { |
1336 | /// { |
|
1337 | /// return this.ElementAt(0); |
1337 | /// return this.ElementAt(0); |
|
1338 | /// } |
1338 | /// } |
|
1339 | /// } |
1339 | /// } |
|
1340 | /// class Test |
1340 | /// class Test |
|
1341 | /// { |
1341 | /// { |
|
1342 | /// public void Foo() |
1342 | /// public void Foo() |
|
1343 | /// { |
1343 | /// { |
|
1344 | /// // Warning: Contents of the collection is never updated |
1344 | /// // Warning: Contents of the collection is never updated |
|
1345 | /// var col = new MyStringCollection(); |
1345 | /// var col = new MyStringCollection(); |
|
1346 | /// string x = col.GetFirstString(); |
1346 | /// string x = col.GetFirstString(); |
|
1347 | /// } |
1347 | /// } |
|
1348 | /// } |
1348 | /// } |
|
1349 | /// </code> |
1349 | /// </code> |
|
1350 | /// </example> |
1350 | /// </example> |
|
1351 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] |
1351 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] |
|
1352 | public sealed class CollectionAccessAttribute : Attribute |
1352 | public sealed class CollectionAccessAttribute : Attribute |
|
1353 | { |
1353 | { |
|
1354 | #region Public Enums, Properties and Fields |
1354 | #region Public Enums, Properties and Fields |
|
1355 | |
1355 | |
|
1356 | public CollectionAccessType CollectionAccessType { get; } |
1356 | public CollectionAccessType CollectionAccessType { get; } |
|
1357 | |
1357 | |
|
1358 | #endregion |
1358 | #endregion |
|
1359 | |
1359 | |
|
1360 | #region Constructors, Destructors and Finalizers |
1360 | #region Constructors, Destructors and Finalizers |
|
1361 | |
1361 | |
|
1362 | public CollectionAccessAttribute(CollectionAccessType collectionAccessType) |
1362 | public CollectionAccessAttribute(CollectionAccessType collectionAccessType) |
|
1363 | { |
1363 | { |
|
1364 | CollectionAccessType = collectionAccessType; |
1364 | CollectionAccessType = collectionAccessType; |
|
1365 | } |
1365 | } |
|
1366 | |
1366 | |
|
1367 | #endregion |
1367 | #endregion |
|
1368 | } |
1368 | } |
|
1369 | |
1369 | |
|
1370 | /// <summary> |
1370 | /// <summary> |
|
1371 | /// Provides a value for the <see cref="CollectionAccessAttribute" /> to define |
1371 | /// Provides a value for the <see cref="CollectionAccessAttribute" /> to define |
|
1372 | /// how the collection method invocation affects the contents of the collection. |
1372 | /// how the collection method invocation affects the contents of the collection. |
|
1373 | /// </summary> |
1373 | /// </summary> |
|
1374 | [Flags] |
1374 | [Flags] |
|
1375 | public enum CollectionAccessType |
1375 | public enum CollectionAccessType |
|
1376 | { |
1376 | { |
|
1377 | /// <summary>Method does not use or modify content of the collection.</summary> |
1377 | /// <summary>Method does not use or modify content of the collection.</summary> |
|
1378 | None = 0, |
1378 | None = 0, |
|
1379 | |
1379 | |
|
1380 | /// <summary>Method only reads content of the collection but does not modify it.</summary> |
1380 | /// <summary>Method only reads content of the collection but does not modify it.</summary> |
|
1381 | Read = 1, |
1381 | Read = 1, |
|
1382 | |
1382 | |
|
1383 | /// <summary>Method can change content of the collection but does not add new elements.</summary> |
1383 | /// <summary>Method can change content of the collection but does not add new elements.</summary> |
|
1384 | ModifyExistingContent = 2, |
1384 | ModifyExistingContent = 2, |
|
1385 | |
1385 | |
|
1386 | /// <summary>Method can add new elements to the collection.</summary> |
1386 | /// <summary>Method can add new elements to the collection.</summary> |
|
1387 | UpdatedContent = ModifyExistingContent | 4 |
1387 | UpdatedContent = ModifyExistingContent | 4 |
|
1388 | } |
1388 | } |
|
1389 | |
1389 | |
|
1390 | /// <summary> |
1390 | /// <summary> |
|
1391 | /// Indicates that the marked method is assertion method, i.e. it halts the control flow if |
1391 | /// Indicates that the marked method is assertion method, i.e. it halts the control flow if |
|
1392 | /// one of the conditions is satisfied. To set the condition, mark one of the parameters with |
1392 | /// one of the conditions is satisfied. To set the condition, mark one of the parameters with |
|
1393 | /// <see cref="AssertionConditionAttribute" /> attribute. |
1393 | /// <see cref="AssertionConditionAttribute" /> attribute. |
|
1394 | /// </summary> |
1394 | /// </summary> |
|
1395 | [AttributeUsage(AttributeTargets.Method)] |
1395 | [AttributeUsage(AttributeTargets.Method)] |
|
1396 | public sealed class AssertionMethodAttribute : Attribute |
1396 | public sealed class AssertionMethodAttribute : Attribute |
|
1397 | { |
1397 | { |
|
1398 | } |
1398 | } |
|
1399 | |
1399 | |
|
1400 | /// <summary> |
1400 | /// <summary> |
|
1401 | /// Indicates the condition parameter of the assertion method. The method itself should be |
1401 | /// Indicates the condition parameter of the assertion method. The method itself should be |
|
1402 | /// marked by <see cref="AssertionMethodAttribute" /> attribute. The mandatory argument of |
1402 | /// marked by <see cref="AssertionMethodAttribute" /> attribute. The mandatory argument of |
|
1403 | /// the attribute is the assertion type. |
1403 | /// the attribute is the assertion type. |
|
1404 | /// </summary> |
1404 | /// </summary> |
|
1405 | [AttributeUsage(AttributeTargets.Parameter)] |
1405 | [AttributeUsage(AttributeTargets.Parameter)] |
|
1406 | public sealed class AssertionConditionAttribute : Attribute |
1406 | public sealed class AssertionConditionAttribute : Attribute |
|
1407 | { |
1407 | { |
|
1408 | #region Public Enums, Properties and Fields |
1408 | #region Public Enums, Properties and Fields |
|
1409 | |
1409 | |
|
1410 | public AssertionConditionType ConditionType { get; } |
1410 | public AssertionConditionType ConditionType { get; } |
|
1411 | |
1411 | |
|
1412 | #endregion |
1412 | #endregion |
|
1413 | |
1413 | |
|
1414 | #region Constructors, Destructors and Finalizers |
1414 | #region Constructors, Destructors and Finalizers |
|
1415 | |
1415 | |
|
1416 | public AssertionConditionAttribute(AssertionConditionType conditionType) |
1416 | public AssertionConditionAttribute(AssertionConditionType conditionType) |
|
1417 | { |
1417 | { |
|
1418 | ConditionType = conditionType; |
1418 | ConditionType = conditionType; |
|
1419 | } |
1419 | } |
|
1420 | |
1420 | |
|
1421 | #endregion |
1421 | #endregion |
|
1422 | } |
1422 | } |
|
1423 | |
1423 | |
|
1424 | /// <summary> |
1424 | /// <summary> |
|
1425 | /// Specifies assertion type. If the assertion method argument satisfies the condition, |
1425 | /// Specifies assertion type. If the assertion method argument satisfies the condition, |
|
1426 | /// then the execution continues. Otherwise, execution is assumed to be halted. |
1426 | /// then the execution continues. Otherwise, execution is assumed to be halted. |
|
1427 | /// </summary> |
1427 | /// </summary> |
|
1428 | public enum AssertionConditionType |
1428 | public enum AssertionConditionType |
|
1429 | { |
1429 | { |
|
1430 | /// <summary>Marked parameter should be evaluated to true.</summary> |
1430 | /// <summary>Marked parameter should be evaluated to true.</summary> |
|
1431 | IS_TRUE = 0, |
1431 | IS_TRUE = 0, |
|
1432 | |
1432 | |
|
1433 | /// <summary>Marked parameter should be evaluated to false.</summary> |
1433 | /// <summary>Marked parameter should be evaluated to false.</summary> |
|
1434 | IS_FALSE = 1, |
1434 | IS_FALSE = 1, |
|
1435 | |
1435 | |
|
1436 | /// <summary>Marked parameter should be evaluated to null value.</summary> |
1436 | /// <summary>Marked parameter should be evaluated to null value.</summary> |
|
1437 | IS_NULL = 2, |
1437 | IS_NULL = 2, |
|
1438 | |
1438 | |
|
1439 | /// <summary>Marked parameter should be evaluated to not null value.</summary> |
1439 | /// <summary>Marked parameter should be evaluated to not null value.</summary> |
|
1440 | IS_NOT_NULL = 3 |
1440 | IS_NOT_NULL = 3 |
|
1441 | } |
1441 | } |
|
1442 | |
1442 | |
|
1443 | /// <summary> |
1443 | /// <summary> |
|
1444 | /// Indicates that the marked method unconditionally terminates control flow execution. |
1444 | /// Indicates that the marked method unconditionally terminates control flow execution. |
|
1445 | /// For example, it could unconditionally throw exception. |
1445 | /// For example, it could unconditionally throw exception. |
|
1446 | /// </summary> |
1446 | /// </summary> |
|
1447 | [Obsolete("Use [ContractAnnotation('=> halt')] instead")] |
1447 | [Obsolete("Use [ContractAnnotation('=> halt')] instead")] |
|
1448 | [AttributeUsage(AttributeTargets.Method)] |
1448 | [AttributeUsage(AttributeTargets.Method)] |
|
1449 | public sealed class TerminatesProgramAttribute : Attribute |
1449 | public sealed class TerminatesProgramAttribute : Attribute |
|
1450 | { |
1450 | { |
|
1451 | } |
1451 | } |
|
1452 | |
1452 | |
|
1453 | /// <summary> |
1453 | /// <summary> |
|
1454 | /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, |
1454 | /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, |
|
1455 | /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters |
1455 | /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters |
|
1456 | /// of delegate type by analyzing LINQ method chains. |
1456 | /// of delegate type by analyzing LINQ method chains. |
|
1457 | /// </summary> |
1457 | /// </summary> |
|
1458 | [AttributeUsage(AttributeTargets.Method)] |
1458 | [AttributeUsage(AttributeTargets.Method)] |
|
1459 | public sealed class LinqTunnelAttribute : Attribute |
1459 | public sealed class LinqTunnelAttribute : Attribute |
|
1460 | { |
1460 | { |
|
1461 | } |
1461 | } |
|
1462 | |
1462 | |
|
1463 | /// <summary> |
1463 | /// <summary> |
|
1464 | /// Indicates that IEnumerable passed as a parameter is not enumerated. |
1464 | /// Indicates that IEnumerable passed as a parameter is not enumerated. |
|
1465 | /// Use this annotation to suppress the 'Possible multiple enumeration of IEnumerable' inspection. |
1465 | /// Use this annotation to suppress the 'Possible multiple enumeration of IEnumerable' inspection. |
|
1466 | /// </summary> |
1466 | /// </summary> |
|
1467 | /// <example> |
1467 | /// <example> |
|
1468 | /// <code> |
1468 | /// <code> |
|
1469 | /// static void ThrowIfNull<T>([NoEnumeration] T v, string n) where T : class |
1469 | /// static void ThrowIfNull<T>([NoEnumeration] T v, string n) where T : class |
|
1470 | /// { |
1470 | /// { |
|
1471 | /// // custom check for null but no enumeration |
1471 | /// // custom check for null but no enumeration |
|
1472 | /// } |
1472 | /// } |
|
1473 | /// |
1473 | /// |
|
1474 | /// void Foo(IEnumerable<string> values) |
1474 | /// void Foo(IEnumerable<string> values) |
|
1475 | /// { |
1475 | /// { |
|
1476 | /// ThrowIfNull(values, nameof(values)); |
1476 | /// ThrowIfNull(values, nameof(values)); |
|
1477 | /// var x = values.ToList(); // No warnings about multiple enumeration |
1477 | /// var x = values.ToList(); // No warnings about multiple enumeration |
|
1478 | /// } |
1478 | /// } |
|
1479 | /// </code> |
1479 | /// </code> |
|
1480 | /// </example> |
1480 | /// </example> |
|
1481 | [AttributeUsage(AttributeTargets.Parameter)] |
1481 | [AttributeUsage(AttributeTargets.Parameter)] |
|
1482 | public sealed class NoEnumerationAttribute : Attribute |
1482 | public sealed class NoEnumerationAttribute : Attribute |
|
1483 | { |
1483 | { |
|
1484 | } |
1484 | } |
|
1485 | |
1485 | |
|
1486 | /// <summary> |
1486 | /// <summary> |
|
1487 | /// Indicates that the marked parameter is a regular expression pattern. |
1487 | /// Indicates that the marked parameter is a regular expression pattern. |
|
1488 | /// </summary> |
1488 | /// </summary> |
|
1489 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
1489 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] |
|
1490 | public sealed class RegexPatternAttribute : Attribute |
1490 | public sealed class RegexPatternAttribute : Attribute |
|
1491 | { |
1491 | { |
|
1492 | } |
1492 | } |
|
1493 | |
1493 | |
|
1494 | /// <summary> |
1494 | /// <summary> |
|
1495 | /// Prevents the Member Reordering feature from tossing members of the marked class. |
1495 | /// Prevents the Member Reordering feature from tossing members of the marked class. |
|
1496 | /// </summary> |
1496 | /// </summary> |
|
1497 | /// <remarks> |
1497 | /// <remarks> |
|
1498 | /// The attribute must be mentioned in your member reordering patterns. |
1498 | /// The attribute must be mentioned in your member reordering patterns. |
|
1499 | /// </remarks> |
1499 | /// </remarks> |
|
1500 | [AttributeUsage( |
1500 | [AttributeUsage( |
|
1501 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] |
1501 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] |
|
1502 | public sealed class NoReorderAttribute : Attribute |
1502 | public sealed class NoReorderAttribute : Attribute |
|
1503 | { |
1503 | { |
|
1504 | } |
1504 | } |
|
1505 | |
1505 | |
|
1506 | /// <summary> |
1506 | /// <summary> |
|
1507 | /// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated |
1507 | /// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated |
|
1508 | /// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve. |
1508 | /// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve. |
|
1509 | /// </summary> |
1509 | /// </summary> |
|
1510 | [AttributeUsage(AttributeTargets.Class)] |
1510 | [AttributeUsage(AttributeTargets.Class)] |
|
1511 | public sealed class XamlItemsControlAttribute : Attribute |
1511 | public sealed class XamlItemsControlAttribute : Attribute |
|
1512 | { |
1512 | { |
|
1513 | } |
1513 | } |
|
1514 | |
1514 | |
|
1515 | /// <summary> |
1515 | /// <summary> |
|
1516 | /// XAML attribute. Indicates the property of some <c>BindingBase</c>-derived type, that |
1516 | /// XAML attribute. Indicates the property of some <c>BindingBase</c>-derived type, that |
|
1517 | /// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will |
1517 | /// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will |
|
1518 | /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties. |
1518 | /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties. |
|
1519 | /// </summary> |
1519 | /// </summary> |
|
1520 | /// <remarks> |
1520 | /// <remarks> |
|
1521 | /// Property should have the tree ancestor of the <c>ItemsControl</c> type or |
1521 | /// Property should have the tree ancestor of the <c>ItemsControl</c> type or |
|
1522 | /// marked with the <see cref="XamlItemsControlAttribute" /> attribute. |
1522 | /// marked with the <see cref="XamlItemsControlAttribute" /> attribute. |
|
1523 | /// </remarks> |
1523 | /// </remarks> |
|
1524 | [AttributeUsage(AttributeTargets.Property)] |
1524 | [AttributeUsage(AttributeTargets.Property)] |
|
1525 | public sealed class XamlItemBindingOfItemsControlAttribute : Attribute |
1525 | public sealed class XamlItemBindingOfItemsControlAttribute : Attribute |
|
1526 | { |
1526 | { |
|
1527 | } |
1527 | } |
|
1528 | |
1528 | |
|
1529 | /// <summary> |
1529 | /// <summary> |
|
1530 | /// XAML attribute. Indicates the property of some <c>Style</c>-derived type, that |
1530 | /// XAML attribute. Indicates the property of some <c>Style</c>-derived type, that |
|
1531 | /// is used to style items of <c>ItemsControl</c>-derived type. This annotation will |
1531 | /// is used to style items of <c>ItemsControl</c>-derived type. This annotation will |
|
1532 | /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties. |
1532 | /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties. |
|
1533 | /// </summary> |
1533 | /// </summary> |
|
1534 | /// <remarks> |
1534 | /// <remarks> |
|
1535 | /// Property should have the tree ancestor of the <c>ItemsControl</c> type or |
1535 | /// Property should have the tree ancestor of the <c>ItemsControl</c> type or |
|
1536 | /// marked with the <see cref="XamlItemsControlAttribute" /> attribute. |
1536 | /// marked with the <see cref="XamlItemsControlAttribute" /> attribute. |
|
1537 | /// </remarks> |
1537 | /// </remarks> |
|
1538 | [AttributeUsage(AttributeTargets.Property)] |
1538 | [AttributeUsage(AttributeTargets.Property)] |
|
1539 | public sealed class XamlItemStyleOfItemsControlAttribute : Attribute |
1539 | public sealed class XamlItemStyleOfItemsControlAttribute : Attribute |
|
1540 | { |
1540 | { |
|
1541 | } |
1541 | } |
|
1542 | |
1542 | |
|
1543 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] |
1543 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] |
|
1544 | public sealed class AspChildControlTypeAttribute : Attribute |
1544 | public sealed class AspChildControlTypeAttribute : Attribute |
|
1545 | { |
1545 | { |
|
1546 | #region Public Enums, Properties and Fields |
1546 | #region Public Enums, Properties and Fields |
|
1547 | |
1547 | |
|
1548 | [NotNull] |
1548 | [NotNull] |
|
1549 | public string TagName { get; } |
1549 | public string TagName { get; } |
|
1550 | |
1550 | |
|
1551 | [NotNull] |
1551 | [NotNull] |
|
1552 | public Type ControlType { get; } |
1552 | public Type ControlType { get; } |
|
1553 | |
1553 | |
|
1554 | #endregion |
1554 | #endregion |
|
1555 | |
1555 | |
|
1556 | #region Constructors, Destructors and Finalizers |
1556 | #region Constructors, Destructors and Finalizers |
|
1557 | |
1557 | |
|
1558 | public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType) |
1558 | public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType) |
|
1559 | { |
1559 | { |
|
1560 | TagName = tagName; |
1560 | TagName = tagName; |
|
1561 | ControlType = controlType; |
1561 | ControlType = controlType; |
|
1562 | } |
1562 | } |
|
1563 | |
1563 | |
|
1564 | #endregion |
1564 | #endregion |
|
1565 | } |
1565 | } |
|
1566 | |
1566 | |
|
1567 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] |
1567 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] |
|
1568 | public sealed class AspDataFieldAttribute : Attribute |
1568 | public sealed class AspDataFieldAttribute : Attribute |
|
1569 | { |
1569 | { |
|
1570 | } |
1570 | } |
|
1571 | |
1571 | |
|
1572 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] |
1572 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] |
|
1573 | public sealed class AspDataFieldsAttribute : Attribute |
1573 | public sealed class AspDataFieldsAttribute : Attribute |
|
1574 | { |
1574 | { |
|
1575 | } |
1575 | } |
|
1576 | |
1576 | |
|
1577 | [AttributeUsage(AttributeTargets.Property)] |
1577 | [AttributeUsage(AttributeTargets.Property)] |
|
1578 | public sealed class AspMethodPropertyAttribute : Attribute |
1578 | public sealed class AspMethodPropertyAttribute : Attribute |
|
1579 | { |
1579 | { |
|
1580 | } |
1580 | } |
|
1581 | |
1581 | |
|
1582 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] |
1582 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] |
|
1583 | public sealed class AspRequiredAttributeAttribute : Attribute |
1583 | public sealed class AspRequiredAttributeAttribute : Attribute |
|
1584 | { |
1584 | { |
|
1585 | #region Public Enums, Properties and Fields |
1585 | #region Public Enums, Properties and Fields |
|
1586 | |
1586 | |
|
1587 | [NotNull] |
1587 | [NotNull] |
|
1588 | public string Attribute { get; } |
1588 | public string Attribute { get; } |
|
1589 | |
1589 | |
|
1590 | #endregion |
1590 | #endregion |
|
1591 | |
1591 | |
|
1592 | #region Constructors, Destructors and Finalizers |
1592 | #region Constructors, Destructors and Finalizers |
|
1593 | |
1593 | |
|
1594 | public AspRequiredAttributeAttribute([NotNull] string attribute) |
1594 | public AspRequiredAttributeAttribute([NotNull] string attribute) |
|
1595 | { |
1595 | { |
|
1596 | Attribute = attribute; |
1596 | Attribute = attribute; |
|
1597 | } |
1597 | } |
|
1598 | |
1598 | |
|
1599 | #endregion |
1599 | #endregion |
|
1600 | } |
1600 | } |
|
1601 | |
1601 | |
|
1602 | [AttributeUsage(AttributeTargets.Property)] |
1602 | [AttributeUsage(AttributeTargets.Property)] |
|
1603 | public sealed class AspTypePropertyAttribute : Attribute |
1603 | public sealed class AspTypePropertyAttribute : Attribute |
|
1604 | { |
1604 | { |
|
1605 | #region Public Enums, Properties and Fields |
1605 | #region Public Enums, Properties and Fields |
|
1606 | |
1606 | |
|
1607 | public bool CreateConstructorReferences { get; } |
1607 | public bool CreateConstructorReferences { get; } |
|
1608 | |
1608 | |
|
1609 | #endregion |
1609 | #endregion |
|
1610 | |
1610 | |
|
1611 | #region Constructors, Destructors and Finalizers |
1611 | #region Constructors, Destructors and Finalizers |
|
1612 | |
1612 | |
|
1613 | public AspTypePropertyAttribute(bool createConstructorReferences) |
1613 | public AspTypePropertyAttribute(bool createConstructorReferences) |
|
1614 | { |
1614 | { |
|
1615 | CreateConstructorReferences = createConstructorReferences; |
1615 | CreateConstructorReferences = createConstructorReferences; |
|
1616 | } |
1616 | } |
|
1617 | |
1617 | |
|
1618 | #endregion |
1618 | #endregion |
|
1619 | } |
1619 | } |
|
1620 | |
1620 | |
|
1621 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] |
1621 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] |
|
1622 | public sealed class RazorImportNamespaceAttribute : Attribute |
1622 | public sealed class RazorImportNamespaceAttribute : Attribute |
|
1623 | { |
1623 | { |
|
1624 | #region Public Enums, Properties and Fields |
1624 | #region Public Enums, Properties and Fields |
|
1625 | |
1625 | |
|
1626 | [NotNull] |
1626 | [NotNull] |
|
1627 | public string Name { get; } |
1627 | public string Name { get; } |
|
1628 | |
1628 | |
|
1629 | #endregion |
1629 | #endregion |
|
1630 | |
1630 | |
|
1631 | #region Constructors, Destructors and Finalizers |
1631 | #region Constructors, Destructors and Finalizers |
|
1632 | |
1632 | |
|
1633 | public RazorImportNamespaceAttribute([NotNull] string name) |
1633 | public RazorImportNamespaceAttribute([NotNull] string name) |
|
1634 | { |
1634 | { |
|
1635 | Name = name; |
1635 | Name = name; |
|
1636 | } |
1636 | } |
|
1637 | |
1637 | |
|
1638 | #endregion |
1638 | #endregion |
|
1639 | } |
1639 | } |
|
1640 | |
1640 | |
|
1641 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] |
1641 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] |
|
1642 | public sealed class RazorInjectionAttribute : Attribute |
1642 | public sealed class RazorInjectionAttribute : Attribute |
|
1643 | { |
1643 | { |
|
1644 | #region Public Enums, Properties and Fields |
1644 | #region Public Enums, Properties and Fields |
|
1645 | |
1645 | |
|
1646 | [NotNull] |
1646 | [NotNull] |
|
1647 | public string Type { get; } |
1647 | public string Type { get; } |
|
1648 | |
1648 | |
|
1649 | [NotNull] |
1649 | [NotNull] |
|
1650 | public string FieldName { get; } |
1650 | public string FieldName { get; } |
|
1651 | |
1651 | |
|
1652 | #endregion |
1652 | #endregion |
|
1653 | |
1653 | |
|
1654 | #region Constructors, Destructors and Finalizers |
1654 | #region Constructors, Destructors and Finalizers |
|
1655 | |
1655 | |
|
1656 | public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName) |
1656 | public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName) |
|
1657 | { |
1657 | { |
|
1658 | Type = type; |
1658 | Type = type; |
|
1659 | FieldName = fieldName; |
1659 | FieldName = fieldName; |
|
1660 | } |
1660 | } |
|
1661 | |
1661 | |
|
1662 | #endregion |
1662 | #endregion |
|
1663 | } |
1663 | } |
|
1664 | |
1664 | |
|
1665 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] |
1665 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] |
|
1666 | public sealed class RazorDirectiveAttribute : Attribute |
1666 | public sealed class RazorDirectiveAttribute : Attribute |
|
1667 | { |
1667 | { |
|
1668 | #region Public Enums, Properties and Fields |
1668 | #region Public Enums, Properties and Fields |
|
1669 | |
1669 | |
|
1670 | [NotNull] |
1670 | [NotNull] |
|
1671 | public string Directive { get; } |
1671 | public string Directive { get; } |
|
1672 | |
1672 | |
|
1673 | #endregion |
1673 | #endregion |
|
1674 | |
1674 | |
|
1675 | #region Constructors, Destructors and Finalizers |
1675 | #region Constructors, Destructors and Finalizers |
|
1676 | |
1676 | |
|
1677 | public RazorDirectiveAttribute([NotNull] string directive) |
1677 | public RazorDirectiveAttribute([NotNull] string directive) |
|
1678 | { |
1678 | { |
|
1679 | Directive = directive; |
1679 | Directive = directive; |
|
1680 | } |
1680 | } |
|
1681 | |
1681 | |
|
1682 | #endregion |
1682 | #endregion |
|
1683 | } |
1683 | } |
|
1684 | |
1684 | |
|
1685 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] |
1685 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] |
|
1686 | public sealed class RazorPageBaseTypeAttribute : Attribute |
1686 | public sealed class RazorPageBaseTypeAttribute : Attribute |
|
1687 | { |
1687 | { |
|
1688 | #region Public Enums, Properties and Fields |
1688 | #region Public Enums, Properties and Fields |
|
1689 | |
1689 | |
|
1690 | [NotNull] |
1690 | [NotNull] |
|
1691 | public string BaseType { get; } |
1691 | public string BaseType { get; } |
|
1692 | |
1692 | |
|
1693 | [CanBeNull] |
1693 | [CanBeNull] |
|
1694 | public string PageName { get; } |
1694 | public string PageName { get; } |
|
1695 | |
1695 | |
|
1696 | #endregion |
1696 | #endregion |
|
1697 | |
1697 | |
|
1698 | #region Constructors, Destructors and Finalizers |
1698 | #region Constructors, Destructors and Finalizers |
|
1699 | |
1699 | |
|
1700 | public RazorPageBaseTypeAttribute([NotNull] string baseType) |
1700 | public RazorPageBaseTypeAttribute([NotNull] string baseType) |
|
1701 | { |
1701 | { |
|
1702 | BaseType = baseType; |
1702 | BaseType = baseType; |
|
1703 | } |
1703 | } |
|
1704 | |
1704 | |
|
1705 | public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName) |
1705 | public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName) |
|
1706 | { |
1706 | { |
|
1707 | BaseType = baseType; |
1707 | BaseType = baseType; |
|
1708 | PageName = pageName; |
1708 | PageName = pageName; |
|
1709 | } |
1709 | } |
|
1710 | |
1710 | |
|
1711 | #endregion |
1711 | #endregion |
|
1712 | } |
1712 | } |
|
1713 | |
1713 | |
|
1714 | [AttributeUsage(AttributeTargets.Method)] |
1714 | [AttributeUsage(AttributeTargets.Method)] |
|
1715 | public sealed class RazorHelperCommonAttribute : Attribute |
1715 | public sealed class RazorHelperCommonAttribute : Attribute |
|
1716 | { |
1716 | { |
|
1717 | } |
1717 | } |
|
1718 | |
1718 | |
|
1719 | [AttributeUsage(AttributeTargets.Property)] |
1719 | [AttributeUsage(AttributeTargets.Property)] |
|
1720 | public sealed class RazorLayoutAttribute : Attribute |
1720 | public sealed class RazorLayoutAttribute : Attribute |
|
1721 | { |
1721 | { |
|
1722 | } |
1722 | } |
|
1723 | |
1723 | |
|
1724 | [AttributeUsage(AttributeTargets.Method)] |
1724 | [AttributeUsage(AttributeTargets.Method)] |
|
1725 | public sealed class RazorWriteLiteralMethodAttribute : Attribute |
1725 | public sealed class RazorWriteLiteralMethodAttribute : Attribute |
|
1726 | { |
1726 | { |
|
1727 | } |
1727 | } |
|
1728 | |
1728 | |
|
1729 | [AttributeUsage(AttributeTargets.Method)] |
1729 | [AttributeUsage(AttributeTargets.Method)] |
|
1730 | public sealed class RazorWriteMethodAttribute : Attribute |
1730 | public sealed class RazorWriteMethodAttribute : Attribute |
|
1731 | { |
1731 | { |
|
1732 | } |
1732 | } |
|
1733 | |
1733 | |
|
1734 | [AttributeUsage(AttributeTargets.Parameter)] |
1734 | [AttributeUsage(AttributeTargets.Parameter)] |
|
1735 | public sealed class RazorWriteMethodParameterAttribute : Attribute |
1735 | public sealed class RazorWriteMethodParameterAttribute : Attribute |
|
1736 | { |
1736 | { |
|
1737 | } |
1737 | } |
|
1738 | } |
1738 | } |
|
1739 | |
1739 | |
|
1740 |
|
1740 |
|
|
1741 | |
1741 | |
|
1742 | |
1742 | |
|
1743 | |
1743 | |