views:

101

answers:

3

I have a method in DAL like:

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
}

In this method, I am passing two nullable types, because these values can be null (and checking them as null in DB Stored Proc). I don't want to use magic numbers, so is it ok passing nullables types like this (from performance as well as architecture flexibility perspective)?

+2  A: 

I think this is perfectly valid - I prefer nullable types to magic values also.

bernhardrusch
+1  A: 

Since nullable types are part of the Base Class Library and not related to any specific language I find it perfectly valid. The only thing that I try to stay away from in public API's are constructs that are language-specific.

Fredrik Mörk
A: 

I think that if you are ok using Collections or Collections.Generic objects, then you should feel perfectly justified using Nullable<T>.

.NET languages are strongly typed, so I think one should expect a typed API method. This type happens to be ( Nullable<int>, Nullable<int>, int ).

Ok by me, too.

maxwellb