- /// [CanBeNull] object Test() => null;
- ///
- /// void UseTest() {
- /// var p = Test();
- /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
- /// }
- ///
- /// [NotNull] object Foo() {
- /// return null; // Warning: Possible 'null' assignment
- /// }
- /// Function Definition Table syntax:
- ///
- /// [ContractAnnotation("=> halt")]
- /// public void TerminationMethod()
- ///
- /// [ContractAnnotation("halt <= condition: false")]
- /// public void Assert(bool condition, string text) // regular assertion method
- ///
- /// [ContractAnnotation("s:null => true")]
- /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
- ///
- /// // A method that returns null if the parameter is null,
- /// // and not null if the parameter is not null
- /// [ContractAnnotation("null => null; notnull => notnull")]
- /// public object Transform(object data)
- ///
- /// [ContractAnnotation("=> true, result: notnull; => false, result: null")]
- /// public bool TryParse(string s, out Person result)
- ///
- /// [Pure] int Multiply(int x, int y) => x * y;
- ///
- /// void M() {
- /// Multiply(123, 42); // Waring: Return value of pure method is not used
- /// }
- ///