Sunday, 15 September 2013

c# - Dynamic Linq Execute Functions inside of Select Statement -



c# - Dynamic Linq Execute Functions inside of Select Statement -

i'm trying grab out formatted values project.

i have function declared:

public static string getformattedlink(string exttitleid) { homecoming "str_" + exttitleid; }

how execute statement select statement in dynamic linq tried.

using (var model = new mk3entities()) { var torigin = (model.titles.where("id > 19632") .select("new(id, getformattedlink(exttitleid))") system.collections.ienumerable) .cast<dynamic>().take(10).tolist(); }

however returns exception: no applicable method 'getformattedlink' exists in type 'title'.

how can formatted results within of select?

it looks scope on title not have "getformattedlink", seek calling method total namespace if not on title class (or move title class if belongs)

c# function dynamic-linq

No comments:

Post a Comment