public IList<T> SQLExecuteQueryCollection<T,Tparam>( string sqlStatement , Tparam t )
where Tparam : class , new( )
where T : class , new( )
{
}
...全文
4337打赏收藏
c# 反射调用类方法
类里有SQLExecuteQueryCollection的多外重载,我想调用类的这个重载方法,试了半天,没有成功。 1.用getMethod 2.用InvokeMember public IList SQLExecuteQueryCollection( string sqlStatement , Tparam t ) where Tparam : class , new( ) where T : class , new( ) { }
method = typeof(SqlHelper).GetMethod("SQLExecuteQueryCollection");
报错:
An unhandled exception of type 'System.Reflection.AmbiguousMatchException' occurred in mscorlib.dll
Additional information: Ambiguous match found.
因为SQLExecuteQueryCollection有很多重载
关键是string sqlStatement , Tparam t 这两个参数如何放到GetMethod中。