Perhaps a ridiculous question, but in Delphi there is an analog "methods of extensions C#"?

0 like 0 dislike
5 views
I do not know how better? quote? or give a link? there was a question about the debug in C#, there I illustrated favorite techniques.. I will try to make a big quote:
you can implement your own simple logger in the form of expansion (in a static utilitarian class) example
internal static void log(this string txt) => tbLog.AppendText(txt + Environment.NewLine);

then it is very convenient to use anywhere
$"something went not so, the parameters of the first {} second {}".log();

... and more convenient option of the compiler for structures, which is clearly not needed in production
#if DEBUG var sw = new Stopwatch(); sw.Start(); #endif /// what we do #if DEBUG sw.Stop(); var ts = sw.Elapsed; $"total time:".log(); $"\\t{ts.Hours:00}:{ts.Minutes:00}:{ts.Seconds:00}.{ts.Milliseconds:000}".log(); #endif

.. again - released Delphi community... but after the habits of a "sweet"... is it worth it?
another question - if there sacharine still there

ps if saharani is in Lazarus - still I would be grateful for infu
by | 5 views

1 Answer

0 like 0 dislike
Method-extension: XE3+, helper class.
\rdocwiki.embarcadero.com/RADStudio/Tokyo/en/Class_a...

Conditional compilation: from the time of Trubo-Pascal, compiler directives
{$IFDEF DEBUG} {$ENDIF}
docwiki.embarcadero.com/RADStudio/Tokyo/en/Conditi...
by

Related questions

0 like 0 dislike
2 answers
asked Apr 1, 2019 by Egorh
0 like 0 dislike
2 answers
asked Apr 1, 2019 by Egorh
0 like 0 dislike
5 answers
0 like 0 dislike
5 answers
0 like 0 dislike
2 answers
asked Mar 23, 2019 by igamity
110,608 questions
257,186 answers
0 comments
32,925 users