L
LordHog
Hello all,
I recently ran into a strange behavior which I don't understand. I
have two 'Add' method which a slightly different signature which they
look like
public void Add( string varName, ScriptVarType type, object value )
public void Add( string varName, ScriptVarType type, object[] values
)
Then in another part of the source base I have the following
declaration
private void Extract( ... )
{
byte[] byteElements;
...
// Where all arguments are assigned before the call is made
ScriptVars.Add( groupsRegEx[1].Value, type, byteElements );
}
The strange item which I don't understand is that instead of call the
method that accepts an array of objects the code is calling the method
where the signature only accepts a single object. Can someone explain
why this is? My guess is since object is the base class of most items
it is also the base class for arrays. Any explanation will be
appreciated. For the time being I will just end up change the method
names to force call to the correct method istead of relying on the
compiler looking at the signature. Thanks
Mark
I recently ran into a strange behavior which I don't understand. I
have two 'Add' method which a slightly different signature which they
look like
public void Add( string varName, ScriptVarType type, object value )
public void Add( string varName, ScriptVarType type, object[] values
)
Then in another part of the source base I have the following
declaration
private void Extract( ... )
{
byte[] byteElements;
...
// Where all arguments are assigned before the call is made
ScriptVars.Add( groupsRegEx[1].Value, type, byteElements );
}
The strange item which I don't understand is that instead of call the
method that accepts an array of objects the code is calling the method
where the signature only accepts a single object. Can someone explain
why this is? My guess is since object is the base class of most items
it is also the base class for arrays. Any explanation will be
appreciated. For the time being I will just end up change the method
names to force call to the correct method istead of relying on the
compiler looking at the signature. Thanks
Mark