I am looking at a method that takes a parameter of object[]
. But if I pass in a single value (ie an object
) it still works.
Is this built in as part of C#? Are object
and object[]
the same?
I ask, because sometimes I need to pass in an array of objects and sometimes I need just one and I am wondering if I need to do this:
public static void MergeRow(object primaryKey, object[] rowValues)
{
MergeRow(new object[]{primaryKey}, rowValues);
}
public static void MergeRow(object[] primaryKey, object[] rowValues)
{
// Rest of my method
or is the first signature enough and I can pass in an array or a single object as I like?
Basically I am asking do I need overload this method?
Can I just do this:
public static void MergeRow(object primaryKey, object[] rowValues)
{
// Rest of my method
and pass in a object
or object[]
.
(Note, the param I am talking about is the first one (primaryKey).
(Note: the method I am calling with the primaryKey parameter is SqlCeResultSet.Seek
which also takes an object[]
)