@@ -307,60 +307,37 @@ void Store<T>(HttpContext httpContext, T tryParsable)
307307
308308 return new [ ]
309309 {
310- // String (technically not "TryParsable", but it's the the special case)
310+ // string is not technically "TryParsable", but it's the special case.
311311 new object [ ] { ( Action < HttpContext , string > ) Store , "plain string" , "plain string" } ,
312- // Int32
313312 new object [ ] { ( Action < HttpContext , int > ) Store , "-42" , - 42 } ,
314313 new object [ ] { ( Action < HttpContext , uint > ) Store , "42" , 42U } ,
315- // Byte
316314 new object [ ] { ( Action < HttpContext , bool > ) Store , "true" , true } ,
317- // Int16
318315 new object [ ] { ( Action < HttpContext , short > ) Store , "-42" , ( short ) - 42 } ,
319316 new object [ ] { ( Action < HttpContext , ushort > ) Store , "42" , ( ushort ) 42 } ,
320- // Int64
321317 new object [ ] { ( Action < HttpContext , long > ) Store , "-42" , - 42L } ,
322318 new object [ ] { ( Action < HttpContext , ulong > ) Store , "42" , 42UL } ,
323- // IntPtr
324319 new object [ ] { ( Action < HttpContext , IntPtr > ) Store , "-42" , new IntPtr ( - 42 ) } ,
325- // Char
326320 new object [ ] { ( Action < HttpContext , char > ) Store , "A" , 'A' } ,
327- // Double
328321 new object [ ] { ( Action < HttpContext , double > ) Store , "0.5" , 0.5 } ,
329- // Single
330322 new object [ ] { ( Action < HttpContext , float > ) Store , "0.5" , 0.5f } ,
331- // Half
332323 new object [ ] { ( Action < HttpContext , Half > ) Store , "0.5" , ( Half ) 0.5f } ,
333- // Decimal
334324 new object [ ] { ( Action < HttpContext , decimal > ) Store , "0.5" , 0.5m } ,
335- // DateTime
336325 new object [ ] { ( Action < HttpContext , DateTime > ) Store , now . ToString ( "o" ) , now } ,
337- // DateTimeOffset
338326 new object [ ] { ( Action < HttpContext , DateTimeOffset > ) Store , nowOffset . ToString ( "o" ) , nowOffset } ,
339- // TimeSpan
340327 new object [ ] { ( Action < HttpContext , TimeSpan > ) Store , TimeSpan . FromSeconds ( 42 ) . ToString ( ) , TimeSpan . FromSeconds ( 42 ) } ,
341- // Guid
342328 new object [ ] { ( Action < HttpContext , Guid > ) Store , guid . ToString ( ) , guid } ,
343- // Version
344329 new object [ ] { ( Action < HttpContext , Version > ) Store , "6.0.0.42" , new Version ( "6.0.0.42" ) } ,
345- // BigInteger
346330 new object [ ] { ( Action < HttpContext , BigInteger > ) Store , "-42" , new BigInteger ( - 42 ) } ,
347- // IPAddress
348331 new object [ ] { ( Action < HttpContext , IPAddress > ) Store , "127.0.0.1" , IPAddress . Loopback } ,
349- // IPEndPoint
350332 new object [ ] { ( Action < HttpContext , IPEndPoint > ) Store , "127.0.0.1:80" , new IPEndPoint ( IPAddress . Loopback , 80 ) } ,
351- // System Enums
352333 new object [ ] { ( Action < HttpContext , AddressFamily > ) Store , "Unix" , AddressFamily . Unix } ,
353334 new object [ ] { ( Action < HttpContext , ILOpCode > ) Store , "Nop" , ILOpCode . Nop } ,
354335 new object [ ] { ( Action < HttpContext , AssemblyFlags > ) Store , "PublicKey,Retargetable" , AssemblyFlags . PublicKey | AssemblyFlags . Retargetable } ,
355- // Nullable<T>
356336 new object [ ] { ( Action < HttpContext , int ? > ) Store , "42" , 42 } ,
357- // Null route and/or query value gives default value.
358- new object ? [ ] { ( Action < HttpContext , int > ) Store , null , 0 } ,
359- new object ? [ ] { ( Action < HttpContext , int ? > ) Store , null , null } ,
360- // Custom Enum
361337 new object [ ] { ( Action < HttpContext , MyEnum > ) Store , "ValueB" , MyEnum . ValueB } ,
362- // Custom record with static TryParse method!
363338 new object [ ] { ( Action < HttpContext , MyTryParsableRecord > ) Store , "42" , new MyTryParsableRecord ( 42 ) } ,
339+ new object ? [ ] { ( Action < HttpContext , int > ) Store , null , 0 } ,
340+ new object ? [ ] { ( Action < HttpContext , int ? > ) Store , null , null } ,
364341 } ;
365342 }
366343 }
0 commit comments