在公共API中使用可空类型

Rag*_*hav 6 c# design-patterns

我在DAL中有一个方法,如:

public bool GetSomeValue(int? a, int?b, int c)
{
   //check a Stored Proc in DB and return true or false based on values of a, b and c
}
Run Code Online (Sandbox Code Playgroud)

在这个方法中,我传递两个可空类型,因为这些值可以为null(并在DB Stored Proc中将它们检查为null).我不想使用幻数,所以可以通过这样的nullables类型(从性能和架构灵活性的角度来看)?

ber*_*sch 2

我认为这是完全有效的 - 我也更喜欢可空类型而不是魔法值。