@@ -310,6 +310,10 @@ public AfterViewEventData(IView view, ViewContext viewContext)
310310/// </summary>
311311public sealed class ViewFoundEventData : EventData
312312{
313+ // Reuse boxed object for common values
314+ private static readonly object BoxedTrue = true ;
315+ private static readonly object BoxedFalse = false ;
316+
313317 /// <summary>
314318 /// The name of the event.
315319 /// </summary>
@@ -364,7 +368,7 @@ public ViewFoundEventData(ActionContext actionContext, bool isMainPage, ActionRe
364368 protected override KeyValuePair < string , object > this [ int index ] => index switch
365369 {
366370 0 => new KeyValuePair < string , object > ( nameof ( ActionContext ) , ActionContext ) ,
367- 1 => new KeyValuePair < string , object > ( nameof ( IsMainPage ) , IsMainPage ) ,
371+ 1 => new KeyValuePair < string , object > ( nameof ( IsMainPage ) , IsMainPage ? BoxedTrue : BoxedFalse ) ,
368372 2 => new KeyValuePair < string , object > ( nameof ( Result ) , Result ) ,
369373 3 => new KeyValuePair < string , object > ( nameof ( ViewName ) , ViewName ) ,
370374 4 => new KeyValuePair < string , object > ( nameof ( View ) , View ) ,
@@ -377,6 +381,10 @@ public ViewFoundEventData(ActionContext actionContext, bool isMainPage, ActionRe
377381/// </summary>
378382public sealed class ViewNotFoundEventData : EventData
379383{
384+ // Reuse boxed object for common values
385+ private static readonly object BoxedTrue = true ;
386+ private static readonly object BoxedFalse = false ;
387+
380388 /// <summary>
381389 /// The name of the event.
382390 /// </summary>
@@ -431,7 +439,7 @@ public ViewNotFoundEventData(ActionContext actionContext, bool isMainPage, Actio
431439 protected override KeyValuePair < string , object > this [ int index ] => index switch
432440 {
433441 0 => new KeyValuePair < string , object > ( nameof ( ActionContext ) , ActionContext ) ,
434- 1 => new KeyValuePair < string , object > ( nameof ( IsMainPage ) , IsMainPage ) ,
442+ 1 => new KeyValuePair < string , object > ( nameof ( IsMainPage ) , IsMainPage ? BoxedTrue : BoxedFalse ) ,
435443 2 => new KeyValuePair < string , object > ( nameof ( Result ) , Result ) ,
436444 3 => new KeyValuePair < string , object > ( nameof ( ViewName ) , ViewName ) ,
437445 4 => new KeyValuePair < string , object > ( nameof ( SearchedLocations ) , SearchedLocations ) ,
0 commit comments