Вы можете привести int?
к int
или использовать a.Value
:
if (a.HasValue)
{
blah = DoSomething((int)a);
// or without a cast as others noted:
blah = DoSomething(a.Value);
}
Если после этого следует else, которому передается значение по умолчанию, вы также можете обрабатывать все это в одной строке:
// using coalesce
blah = DoSomething(a?? 0 /* default value */);
// or using ternary
blah = DoSomething(a.HasValue? a.Value : 0 /* default value */);
// or (thanks @Guffa)
blah = DoSomething(a.GetValueOrDefault(/* optional default val */));