Click here to Skip to main content
15,879,535 members
Home / Discussions / C#
   

C#

 
GeneralRe: Modifying multiple fields based on a condition Pin
Bice908-Feb-20 6:22
Bice908-Feb-20 6:22 
QuestionC# Interviews on the horizon Pin
Andrew Torrance7-Feb-20 3:11
Andrew Torrance7-Feb-20 3:11 
AnswerRe: C# Interviews on the horizon Pin
OriginalGriff7-Feb-20 3:52
mveOriginalGriff7-Feb-20 3:52 
GeneralRe: C# Interviews on the horizon Pin
Andrew Torrance7-Feb-20 6:51
Andrew Torrance7-Feb-20 6:51 
GeneralRe: C# Interviews on the horizon Pin
phil.o7-Feb-20 23:05
professionalphil.o7-Feb-20 23:05 
QuestionPerformance penalty of Debug.Assert in .NET Pin
Rob Philpott4-Feb-20 23:44
Rob Philpott4-Feb-20 23:44 
AnswerRe: Performance penalty of Debug.Assert in .NET Pin
OriginalGriff4-Feb-20 23:57
mveOriginalGriff4-Feb-20 23:57 
AnswerRe: Performance penalty of Debug.Assert in .NET Pin
OriginalGriff5-Feb-20 0:17
mveOriginalGriff5-Feb-20 0:17 
I just checked, and Debug.Assert is completely removed from Release code:
Code:
C#
private void FrmMain_Shown(object sender, EventArgs e)
    {
    ...
    string[] dataWithCounts = dataFromTextBox.GroupBy(d => d).Select(g =>$"{g.Key}({g.Count()})").ToArray();
    Debug.Assert(dataWithCounts.Count() != 3);
    }

Debug:
IL_008c: call class [mscorlib]System.Collections.Generic.IEnumerable`1<!!1> [System.Core]System.Linq.Enumerable::Select<class [System.Core]System.Linq.IGrouping`2<string, string>, string>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>, class [mscorlib]System.Func`2<!!0, !!1>)
IL_0091: call !!0[] [System.Core]System.Linq.Enumerable::ToArray<string>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
IL_0096: stloc.1
IL_0097: ldloc.1
IL_0098: call int32 [System.Core]System.Linq.Enumerable::Count<string>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
IL_009d: ldc.i4.3
IL_009e: ceq
IL_00a0: ldc.i4.0
IL_00a1: ceq
IL_00a3: call void [System]System.Diagnostics.Debug::Assert(bool)
IL_00a8: nop
IL_00a9: ret
} // end of method FrmMain::FrmMain_Shown
Release:
IL_0089: call class [mscorlib]System.Collections.Generic.IEnumerable`1<!!1> [System.Core]System.Linq.Enumerable::Select<class [System.Core]System.Linq.IGrouping`2<string, string>, string>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>, class [mscorlib]System.Func`2<!!0, !!1>)
IL_008e: call !!0[] [System.Core]System.Linq.Enumerable::ToArray<string>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
IL_0093: pop
IL_0094: ret

"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Rob Philpott5-Feb-20 0:36
Rob Philpott5-Feb-20 0:36 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Richard Deeming5-Feb-20 0:44
mveRichard Deeming5-Feb-20 0:44 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Rob Philpott5-Feb-20 1:13
Rob Philpott5-Feb-20 1:13 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Rob Philpott5-Feb-20 0:40
Rob Philpott5-Feb-20 0:40 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
OriginalGriff5-Feb-20 1:23
mveOriginalGriff5-Feb-20 1:23 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
Luc Pattyn5-Feb-20 8:54
sitebuilderLuc Pattyn5-Feb-20 8:54 
GeneralRe: Performance penalty of Debug.Assert in .NET Pin
OriginalGriff5-Feb-20 9:08
mveOriginalGriff5-Feb-20 9:08 
AnswerRe: Performance penalty of Debug.Assert in .NET Pin
jsc4210-Feb-20 4:13
professionaljsc4210-Feb-20 4:13 
QuestionHow do i get value from string Pin
SSI134-Feb-20 19:40
SSI134-Feb-20 19:40 
AnswerRe: How do i get value from string Pin
OriginalGriff4-Feb-20 20:02
mveOriginalGriff4-Feb-20 20:02 
QuestionDecrease download speed in DownloadFileAsync Pin
Ayub Kokabi3-Feb-20 20:38
Ayub Kokabi3-Feb-20 20:38 
AnswerRe: Decrease download speed in DownloadFileAsync Pin
Pete O'Hanlon3-Feb-20 20:58
mvePete O'Hanlon3-Feb-20 20:58 
GeneralRe: Decrease download speed in DownloadFileAsync Pin
Ayub Kokabi4-Feb-20 3:38
Ayub Kokabi4-Feb-20 3:38 
AnswerRe: Decrease download speed in DownloadFileAsync Pin
Gerry Schmitz4-Feb-20 3:18
mveGerry Schmitz4-Feb-20 3:18 
GeneralRe: Decrease download speed in DownloadFileAsync Pin
Ayub Kokabi4-Feb-20 6:07
Ayub Kokabi4-Feb-20 6:07 
AnswerRe: Decrease download speed in DownloadFileAsync Pin
MadMyche7-Feb-20 8:04
professionalMadMyche7-Feb-20 8:04 
GeneralRe: Decrease download speed in DownloadFileAsync Pin
Ayub Kokabi7-Feb-20 19:45
Ayub Kokabi7-Feb-20 19:45 

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.