/*...*/
containing the specified text.
- /*...*/
containing the specified text.
-
-
-
- /*...*/
containing the specified text.
-
-
-
-
- /*...*/
containing the specified text.
-
-
-
-
-
- Info
will exclude Verbose
messages and include Info
,
- Warning
and Error
messages.
- Info
will exclude Verbose
messages and include Info
,
- Warning
and Error
messages.
- - This attribute only applies to types, not fields: - it's entirely feasible to have a readonly field of a mutable type, or a read/write - field of an immutable type. In such cases for reference types (classes and interfaces) - it's important to distinguish between the value of the variable (a reference) and the - object it refers to. Value types are more complicated as in some cases the compiler - will copy values before operating on them; however as all value types in Noda Time are - immutable (aside from explictily implemented serialization operations) this rarely causes - an issue. -
-- Some types may be publicly immutable, but contain privately mutable - aspects, e.g. caches. If it proves to be useful to indicate the kind of - immutability we're implementing, we can add an appropriate property to this - attribute. -
-AppendFraction(1200, 4, 5, builder)
will result in "0120" being
- appended to the builder. The value is treated as effectively 0.01200 because
- the scale is 5, but only 4 digits are formatted.
- AppendFractionTruncate(1200, 4, 5, builder)
will result in "001" being
- appended to the builder. The value is treated as effectively 0.01200 because
- the scale is 5; only 4 digits are formatted (leaving "0120") and then the rightmost
- 0 digit is truncated.
-
- public override int GetHashCode()
- {
- int hash = HashCodeHelper.Initialize();
- hash = HashCodeHelper.Hash(hash, Field1);
- hash = HashCodeHelper.Hash(hash, Field1);
- hash = HashCodeHelper.Hash(hash, Field1);
- ...
- return hash;
- }
-
- true
if the zone interval containing this value has a non-zero savings
- component; false
otherwise.
- [CanBeNull] public object Test() { return null; }
- public void UseTest() {
- var p = Test();
- var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
- }
-
- [NotNull] public object Foo() {
- return null; // Warning: Possible 'null' assignment
- }
-
- [StringFormatMethod("message")]
- public void ShowError(string message, params object[] args) { /* do something */ }
- public void Foo() {
- ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
- }
-
- public void Foo(string param) {
- if (param == null)
- throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
- }
-
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("s:null=>false; =>true,result:notnull; =>false, result:null")]
- public bool TryParse(string s, out Person result)
-
- [LocalizationRequiredAttribute(true)]
- public class Foo {
- private string str = "my string"; // Warning: Localizable string
- }
-
- [Pure] private int Multiply(int x, int y) { return x * y; }
- public void Foo() {
- const int a = 2, b = 2;
- Multiply(a, b); // Waring: Return value of pure method is not used
- }
-