Delphi-Prism-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28:
| namespace Extensions;
interface
uses System.Collections.Generic, System.Linq, System.Text, System.Runtime.CompilerServices;
type [Extension] DateTimeExtender = public static class protected public [Extension] class method GetTickCount(ExtendingdtTime : DateTime) : Integer; end; implementation
class method DateTimeExtender.GetTickCount(ExtendingdtTime : DateTime) : Integer; begin var Time := DateTime.Now; exit(Time.Hour*60*60*1000 + Time.Minute*60*1000 + Time.Second*1000 + Time.Millisecond); end;
end. |
Wie bekomme ich es hin, die Methode - praktisch wie DateTime.Now - aufrufen zu können, OHNE vorher eine Instanz erstellen zu müssen?
Die Lösung ist nicht siebzehn.