Click here to Skip to main content
15,503,579 members
Home / Discussions / C#
   

C#

 
GeneralRe: Modifying multiple fields based on a condition Pin
Bice908-Feb-20 5:25
Bice908-Feb-20 5:25 
GeneralRe: Modifying multiple fields based on a condition Pin
Gerry Schmitz8-Feb-20 5:52
mveGerry Schmitz8-Feb-20 5:52 
GeneralRe: Modifying multiple fields based on a condition Pin
Bice908-Feb-20 7:22
Bice908-Feb-20 7:22 
QuestionC# Interviews on the horizon Pin
Andrew Torrance7-Feb-20 4:11
Andrew Torrance7-Feb-20 4:11 
AnswerRe: C# Interviews on the horizon Pin
OriginalGriff7-Feb-20 4:52
mveOriginalGriff7-Feb-20 4:52 
GeneralRe: C# Interviews on the horizon Pin
Andrew Torrance7-Feb-20 7:51
Andrew Torrance7-Feb-20 7:51 
GeneralRe: C# Interviews on the horizon Pin
phil.o8-Feb-20 0:05
mvephil.o8-Feb-20 0:05 
QuestionPerformance penalty of Debug.Assert in .NET Pin
Rob Philpott5-Feb-20 0:44
Rob Philpott5-Feb-20 0:44 
I'm writing some low level C# which is doing bit level operations (shifting/logic) which needs to be very high performance (real time application). Usually, I'd just do some checks and throw an exception if things aren't right, but I can't afford the overhead of that here.

Back in the day, in C++ I'd just use assertions for my checks which would cease to exist completely in the release build. In C#, we have Debug.Assert but its use seems greyer to me, because debug vs. release in .NET is greyer. Macros disappear depending on switches, but it seems the only way a Debug.Assert can disappear is if its hardedcoded in the JIT that way.

So my question I guess is does the Debug.Assert make it into the MSIL regardless of debug/release, and then does the JIT just remove it for release and remove it completely?

What happens with something like this in a release build, does the counter increment?
Debug.Assert(++counter != 100);
Regards,
Rob Philpott.

AnswerRe: Performance penalty of Debug.Assert in .NET Pin
OriginalGriff5-Feb-20 0:57
mveOriginalGriff5-Feb-20 0:57 
AnswerRe: Performance penalty of Debug.Assert in .NET Pin
OriginalGriff5-Feb-20 1:17
mveOriginalGriff5-Feb-20 1:17 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Rob Philpott5-Feb-20 1:36
Rob Philpott5-Feb-20 1:36 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Richard Deeming5-Feb-20 1:44
mveRichard Deeming5-Feb-20 1:44 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Rob Philpott5-Feb-20 2:13
Rob Philpott5-Feb-20 2:13 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Rob Philpott5-Feb-20 1:40
Rob Philpott5-Feb-20 1:40 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
OriginalGriff5-Feb-20 2:23
mveOriginalGriff5-Feb-20 2:23 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Luc Pattyn5-Feb-20 9:54
sitebuilderLuc Pattyn5-Feb-20 9:54 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
OriginalGriff5-Feb-20 10:08
mveOriginalGriff5-Feb-20 10:08 
AnswerRe: Performance penalty of Debug.Assert in .NET Pin
jsc4210-Feb-20 5:13
professionaljsc4210-Feb-20 5:13 
QuestionHow do i get value from string Pin
SSI134-Feb-20 20:40
SSI134-Feb-20 20:40 
AnswerRe: How do i get value from string Pin
OriginalGriff4-Feb-20 21:02
mveOriginalGriff4-Feb-20 21:02 
QuestionDecrease download speed in DownloadFileAsync Pin
Ayub Kokabi3-Feb-20 21:38
Ayub Kokabi3-Feb-20 21:38 
AnswerRe: Decrease download speed in DownloadFileAsync Pin
Pete O'Hanlon3-Feb-20 21:58
mvaPete O'Hanlon3-Feb-20 21:58 
GeneralRe: Decrease download speed in DownloadFileAsync Pin
Ayub Kokabi4-Feb-20 4:38
Ayub Kokabi4-Feb-20 4:38 
AnswerRe: Decrease download speed in DownloadFileAsync Pin
Gerry Schmitz4-Feb-20 4:18
mveGerry Schmitz4-Feb-20 4:18 
GeneralRe: Decrease download speed in DownloadFileAsync Pin
Ayub Kokabi4-Feb-20 7:07
Ayub Kokabi4-Feb-20 7:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.