Linq and epicor 9


Is it possible to use linq in an Epicor 9.05.702 customisation?

It’s seems that I can’t add the System.Core.dll through Reference assembly manager. Am I missing something?

Got it.

I moved the System.Core.dll in the Epicor Client folder.

Although, i keep getting this error : ‘System.Windows.Forms.Control.ControlCollection’ does not contain a definition for ‘OfType’
IEnumerable<EpiShape> test = grpBoxRessSelect.Controls.OfType<EpiShape>();

I’ve added System.Core.dll and using System.Linq

Any ideas?

My guess is the error has to do with the version of the System.Windows.Form used more than a Linq issue. You can use, code like that listed below, to recursively get all controls that are part of a form regardless of parent.

private void FindControls(Control ctrlContainer) 
	foreach (Control ctrl in ctrlContainer.Controls) 
		if (ctrl.GetType() == typeof(EpiTextBox))  // Specifiy type of Control
			// Do whatever with Text Box

		if (ctrl.HasChildren) 

FindControls(this.UD01Form) // Change to form you wish to recursively find controls for
1 Like

Hi Dan,

Thanks for your response. I finally used the Find method on Controls because my search was about the control name for particular reasons.

Regardind Linq, even a simple list can’t be used:

orderedList = list.OrderBy(o => o).ToList();

Error: CS1525 - line 354 (1784) - Invalid expression term ‘>’
Error: CS1026 - line 354 (1784) - ) expected
Error: CS1002 - line 354 (1784) - ; expected
Error: CS1525 - line 354 (1784) - Invalid expression term ‘)’

Anyway, I simply want to thank you your time and for the piece of code you’ve provided.