Skip to content

Commit d9c6ca8

Browse files
authored
Int32Type: avoid unnecessary boxing for common cases (#3513)
1 parent 9f30007 commit d9c6ca8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/NHibernate/Type/Int32Type.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ public override object Get(DbDataReader rs, int index, ISessionImplementor sessi
3131
{
3232
try
3333
{
34-
return rs[index] switch
34+
var value = rs[index];
35+
return value switch
3536
{
37+
int _ => value,
3638
BigInteger bi => (int) bi,
3739
var c => Convert.ToInt32(c)
3840
};

0 commit comments

Comments
 (0)