public sealed class BeforeViewPageEventData : EventData
{
protected override KeyValuePair<string, object> this[int index] => index switch
{
0 => new KeyValuePair<string, object>(nameof(Page), Page),
1 => new KeyValuePair<string, object>(nameof(ViewContext), ViewContext),
2 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
3 => new KeyValuePair<string, object>(nameof(HttpContext), HttpContext),
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
VB:
Option Compare Text
Option Explicit On
Option Infer Off
Option Strict On
Public NotInheritable Class BeforeViewPageEventData
Inherits EventData
Default Protected Overrides Property Item(index As Integer) As KeyValuePair(Of String, Object)
Get
Return tempVar
End Get
End Property
End Class
You missed the ReadOnly and the Select Case in the Get body.
Default Protected Overrides ReadOnly Property Item(index As Integer) As KeyValuePair(Of String, Object)
Get
Select Case index
Case 0
Return New KeyValuePair(Of String, Object)(NameOf(Page), Page)
Case 1
Return New KeyValuePair(Of String, Object)(NameOf(ViewContext), ViewContext)
Case 2
Return New KeyValuePair(Of String, Object)(NameOf(ActionDescriptor), ActionDescriptor)
Case 3
Return New KeyValuePair(Of String, Object)(NameOf(HttpContext), HttpContext)
Case Else
Throw New IndexOutOfRangeException(NameOf(index))
End Select
End Get
End Property
C#
VB:
You missed the ReadOnly and the
Select Case
in the Get body.