Changes

Internal:Coding Practices

336 bytes added, 11:28, 16 October 2015
TimeSpan t = cts - new DateTime(1, 1, 1); // calculate a timespan
int days = (int)t.TotalDays+1; // for casting to an integer
</syntaxhighlight>
 
=== Distinguish objects based on their MetaClass type? ===
If certain actions should only be executed for objects having a specific type, use the <code>is</code> keyword. This check also considers the inheritance.
<syntaxhighlight lang="csharp">
if (obj is UBIK.Runtime.AC_DOUBLE)
{
//do something
}
</syntaxhighlight>
[[Category:Best Practices (internal)|Coding Practices]]
10,686
edits