In this line:
public static T Try<T>(object objLock, int timeout, Func<T> f)
Func<T>
is looking for a function that takes no parameters and returns a T
. You're sending it a delegate that takes a DataSet
and returns an object.
Since you're creating a new DataSet
in your delegate anyway, just drop the DataSet ds
from the delegate and you should be all set.
In fact, you can simplify this to:
Lock.Try<object>(inCommandObj.Connection, _timeout, () =>
{
var ds = new DataSet();
dataAdapter = new OdbcDataAdapter(inCommandObj);
returningObj = dataAdapter.Fill(ds);
done = true;
return returningObj;
});
If that doesn't do what you intended, then you need to refactor Try
to take a different Func
argument, or consider a totally different solution.