@@ -307,60 +307,37 @@ void Store<T>(HttpContext httpContext, T tryParsable)
307
307
308
308
return new [ ]
309
309
{
310
- // String (technically not "TryParsable", but it's the the special case)
310
+ // string is not technically "TryParsable", but it's the special case.
311
311
new object [ ] { ( Action < HttpContext , string > ) Store , "plain string" , "plain string" } ,
312
- // Int32
313
312
new object [ ] { ( Action < HttpContext , int > ) Store , "-42" , - 42 } ,
314
313
new object [ ] { ( Action < HttpContext , uint > ) Store , "42" , 42U } ,
315
- // Byte
316
314
new object [ ] { ( Action < HttpContext , bool > ) Store , "true" , true } ,
317
- // Int16
318
315
new object [ ] { ( Action < HttpContext , short > ) Store , "-42" , ( short ) - 42 } ,
319
316
new object [ ] { ( Action < HttpContext , ushort > ) Store , "42" , ( ushort ) 42 } ,
320
- // Int64
321
317
new object [ ] { ( Action < HttpContext , long > ) Store , "-42" , - 42L } ,
322
318
new object [ ] { ( Action < HttpContext , ulong > ) Store , "42" , 42UL } ,
323
- // IntPtr
324
319
new object [ ] { ( Action < HttpContext , IntPtr > ) Store , "-42" , new IntPtr ( - 42 ) } ,
325
- // Char
326
320
new object [ ] { ( Action < HttpContext , char > ) Store , "A" , 'A' } ,
327
- // Double
328
321
new object [ ] { ( Action < HttpContext , double > ) Store , "0.5" , 0.5 } ,
329
- // Single
330
322
new object [ ] { ( Action < HttpContext , float > ) Store , "0.5" , 0.5f } ,
331
- // Half
332
323
new object [ ] { ( Action < HttpContext , Half > ) Store , "0.5" , ( Half ) 0.5f } ,
333
- // Decimal
334
324
new object [ ] { ( Action < HttpContext , decimal > ) Store , "0.5" , 0.5m } ,
335
- // DateTime
336
325
new object [ ] { ( Action < HttpContext , DateTime > ) Store , now . ToString ( "o" ) , now } ,
337
- // DateTimeOffset
338
326
new object [ ] { ( Action < HttpContext , DateTimeOffset > ) Store , nowOffset . ToString ( "o" ) , nowOffset } ,
339
- // TimeSpan
340
327
new object [ ] { ( Action < HttpContext , TimeSpan > ) Store , TimeSpan . FromSeconds ( 42 ) . ToString ( ) , TimeSpan . FromSeconds ( 42 ) } ,
341
- // Guid
342
328
new object [ ] { ( Action < HttpContext , Guid > ) Store , guid . ToString ( ) , guid } ,
343
- // Version
344
329
new object [ ] { ( Action < HttpContext , Version > ) Store , "6.0.0.42" , new Version ( "6.0.0.42" ) } ,
345
- // BigInteger
346
330
new object [ ] { ( Action < HttpContext , BigInteger > ) Store , "-42" , new BigInteger ( - 42 ) } ,
347
- // IPAddress
348
331
new object [ ] { ( Action < HttpContext , IPAddress > ) Store , "127.0.0.1" , IPAddress . Loopback } ,
349
- // IPEndPoint
350
332
new object [ ] { ( Action < HttpContext , IPEndPoint > ) Store , "127.0.0.1:80" , new IPEndPoint ( IPAddress . Loopback , 80 ) } ,
351
- // System Enums
352
333
new object [ ] { ( Action < HttpContext , AddressFamily > ) Store , "Unix" , AddressFamily . Unix } ,
353
334
new object [ ] { ( Action < HttpContext , ILOpCode > ) Store , "Nop" , ILOpCode . Nop } ,
354
335
new object [ ] { ( Action < HttpContext , AssemblyFlags > ) Store , "PublicKey,Retargetable" , AssemblyFlags . PublicKey | AssemblyFlags . Retargetable } ,
355
- // Nullable<T>
356
336
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
361
337
new object [ ] { ( Action < HttpContext , MyEnum > ) Store , "ValueB" , MyEnum . ValueB } ,
362
- // Custom record with static TryParse method!
363
338
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 } ,
364
341
} ;
365
342
}
366
343
}
0 commit comments