System.Linq
Author: nalin
Creation Date: 6/19/2012 4:36 AM
profile picture

nalin

#1
I have been trying to calculate the average of double values stored in a List. I understand that to be able to do this I should be using System.Linq. Do I need to check one of the .Net references to be able to do this ? If so, which reference do I need to check?
profile picture

Eugene

#2
LINQ is a C# 3.0 feature whereas Wealth-Lab's built-in Editor version supports C# 2.0. The thing is, our Editor component right now is outdated. Even if you added that reference to System.Data.Linq.dll, lambda expressions won't be interpreted by the Editor. Please create a new support ticket to request this important update.

Workaround: if you need to write LINQ queries, you can freely do it in a Strategy library (Indicator library, or any other compiled addon for that purpose) using external C# IDE like SharpDevelop or Visual Studio, after including a reference to System.Linq.

p.s. For your calculation question, I suggest you start a new topic and we'll sort it out using C# 2.0.
profile picture

Eugene

#3
Note: even though the upcoming Wealth-Lab 6.4 is based on .NET 4.0, the built-in Strategy editor still only supports C# 2.0 features and to utilize new language features like LINQ, Parallel, anonymous classes etc. one will still have to resort to compiled Strategy libraries (DLLs). Hopefully, until at least version 6.5 - if Fidelity agrees to fix this in 6.5.
profile picture

Cone

#4
The Editor won't support the Intellisense for these .NET 4.0 features in 6.4, but it shouldn't be a problem to utilize them without Intellisense. Is this not your experience Eugene?
profile picture

Eugene

#5
Supporting Intellisense is a separate question, Robert.

Scripts will not be able to utilize .NET 3.0/4.0 features because this code won't compile in the Strategy Editor. But compiled Strategy libraries are fine in this sense - before 6.4, they were limited by .NET 3.5 as target platform choice.
profile picture

Eugene

#6
To anyone interested.

You can utilize C# 4.0 features like Tasks (anonymous types, LINQ...) in the Strategy Editor right now. Follow this simple workaround from the FAQ: I'm using Wealth-Lab 6.4 but can't use C# 3.0/4.0 language features such as LINQ, Tasks etc. What's wrong?
profile picture

jduke

#7
I have run into this bug but cannot find the simple workaround referenced above. It is not contained in the link.

How to use System.Linq function (eg Average) without getting this error?

RESOLVED: Tracked down at this link: https://www.wealth-lab.com/Forum/Posts/WLP-6-9-20-7-has-compiler-error-with-LINQ-methods-39743
profile picture

Eugene

#8
A forum search goes a long way! :) Glad you got it solved yourself.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).