I have below code snippet and getting an error as mentioned below.
string[] companies = {
"Consolidated Messenger", "Alpine Ski House", "Southridge Video", "City Power & Light",
"Coho Winery", "Wide World Importers", "Graphic Design Institute", "Adventure Works",
"Humongous Insurance", "Woodgrove Bank", "Margie's Travel", "Northwind Traders",
"Blue Yonder Airlines", "Trey Research", "The Phone Company",
"Wingtip Toys", "Lucerne Publishing", "Fourth Coffee"
};
var exp = companies.AsQueryable<string>();
// Compose the expression tree that represents the parameter to the predicate.
ParameterExpression pe = Expression.Parameter(typeof(string), "company");
// The IQueryable data to query.
IQueryable<String> queryableData = companies.AsQueryable<string>();
MethodCallExpression orderByCallExpression1 = Expression.Call(
typeof(Queryable),
"OrderBy",
new Type[] { queryableData.ElementType },
Expression.Lambda<Func<string, string>>(pe, new ParameterExpression[] { pe })
);
System.InvalidOperationException: 'No generic method 'OrderBy' on type 'System.Linq.Queryable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. '
Please guide whats wrong in here?