0

I am trying to get the method ExecuteQuery from Azure's CloudTable. There are four methods by this name.

public virtual IEnumerable<TElement> ExecuteQuery<TElement>(TableQuery<TElement> query, TableRequestOptions requestOptions = null, OperationContext operationContext = null) where TElement : ITableEntity, new();
public virtual IEnumerable<DynamicTableEntity> ExecuteQuery(TableQuery query, TableRequestOptions requestOptions = null, OperationContext operationContext = null);
public virtual IEnumerable<TResult> ExecuteQuery<TElement, TResult>(TableQuery<TElement> query, EntityResolver<TResult> resolver, TableRequestOptions requestOptions = null, OperationContext operationContext = null) where TElement : ITableEntity, new();
public virtual IEnumerable<TResult> ExecuteQuery<TResult>(TableQuery query, EntityResolver<TResult> resolver, TableRequestOptions requestOptions = null, OperationContext operationContext = null);

The one I am trying to get is the first one. And I am using the following code.

var testQuery = new TableQuery<TestEntity>();
var methodInfo = typeof(CloudTable).GetMethod("ExecuteQuery", new[] { testQuery.GetType(), typeof(TableRequestOptions), typeof(OperationContext) });

However methodInfo results in as null. Why can't it find the specified method? As I look returning null means there is no such method. By the way TestEntity is a dummy class inheriting from TableEntity and in turn implementing the interface ITableEntity. Therefore the conditions are met for the specified method.

I am going to use this method on a class which is created by reflection at run time. Therefore I am trying to get the method this way.

Nuri Tasdemir
  • 9,720
  • 3
  • 42
  • 67
  • http://stackoverflow.com/questions/232535/how-do-i-use-reflection-to-call-a-generic-method – Jonathan Allen Jun 03 '16 at 06:41
  • 1
    @JonathanAllen In the answer of that question they show how to invoke a generic method once they have it. I know how to invoke it. I am having trouble getting the method. So that answer is not useful in my case. – Nuri Tasdemir Jun 03 '16 at 06:48

0 Answers0