linq
linq copied to clipboard
When using a string for the selector using TypeScript it doe snot compile. Please help I am not very familiar with TypeScript
Like doing this Enumerable.from(dataVals).where("$.indexOf("" + parameterName + "") !== -1").singleOrDefault("", "$").replace(/+/g, " ").split("=")[1];
instead of doing return Enumerable.from(dataVals).where(p=> p.indexOf(parameterName) !== -1).singleOrDefault().replace(/+/g, " ").split("=")[1];
for most cases I can rewrite but I have a few specific that it is easier to use the string selector
Thanks
I haven't tried this, but I notice that you have some double quotes in there. Not sure what that is about...shouldn't it be: where("$.indexOf(" + parameterName + ") !== -1") ?
I looked at the typescript definitions and if I want to use the "$." syntax all I have to do is add the following typing. select<TResult>(selector: string): IEnumerable<TResult>; in addition to select<TResult>(selector: (element: T, index: number) => TResult): IEnumerable<TResult>;
What do you think? I could submit a pull request