29 | /// [StringFormatMethod("message")]
30 | /// public void ShowError(string message, params object[] args)
31 | /// {
32 | /// //Do something
33 | /// }
34 | /// public void Foo()
35 | /// {
36 | /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
37 | /// }
38 | ///
39 | ///
63 | /// public void Foo(string param)
64 | /// {
65 | /// if (param == null)
66 | /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
67 | /// }
68 | ///
69 | ///
79 | /// [CanBeNull]
80 | /// public object Test()
81 | /// {
82 | /// return null;
83 | /// }
84 | ///
85 | /// public void UseTest()
86 | /// {
87 | /// var p = Test();
88 | /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
89 | /// }
90 | ///
91 | ///
100 | /// [NotNull]
101 | /// public object Foo()
102 | /// {
103 | /// return null; // Warning: Possible 'null' assignment
104 | /// }
105 | ///
106 | /// Function Definition Table syntax:
115 | ///
130 | /// [ContractAnnotation("=> halt")]
131 | /// public void TerminationMethod()
132 | ///
134 | /// [ContractAnnotation("halt <= condition: false")]
135 | /// public void Assert(bool condition, string text) // Regular Assertion method
136 | ///
138 | /// [ContractAnnotation("s:null => true")]
139 | /// public bool IsNullOrEmpty(string s) // String.IsNullOrEmpty
140 | ///
142 | /// // A method that returns null if the parameter is null, and not null if the parameter is not null
143 | /// [ContractAnnotation("null => null; notnull => notnull")]
144 | /// public object Transform(object data)
145 | ///
147 | /// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
148 | /// public bool TryParse(string s, out Person result)
149 | ///
182 | /// [Pure]
183 | /// private int Multiply(int x, int y)
184 | /// {
185 | /// return x*y;
186 | /// }
187 | ///
188 | /// public void Foo()
189 | /// {
190 | /// const int a=2, b=2;
191 | /// Multiply(a, b); // Waring: Return value of pure method is not used
192 | /// }
193 | ///
194 | ///