LINQ

Info about design forms features
PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

LINQ

Postby PetrS » 03 Apr 2015, 11:40

size=150LINQ/size
Version 13.400.33+

Language-Integrated Query (LINQ) is a set of features that extends powerful query capabilities to the language syntax. LINQ introduces standard, easily-learned patterns for querying and updating data.

:!: color=#FF0000bLinq can improve your code dramatically. It can make it much more efficient, readable and maintainable. Please pay attention to this feature!/b/color

SDF inherits LINQ functionality from C#. There are some syntax changes and limitations:
list
*SDF implements most common used LINQ methods. Some complex C# methods are missing.
iAny LINQ method can be implemented/added if necessary. Post request here, if you need it./i/*:m
*All LINQ methods are encapsulated in static SDF object Linq. You have to call them like "Linq.Select(...)".
iMethods are not available directly as an extension of IEnumerable type./i/*:m/list:u


:idea: Read more about LINQ in C# url=https://msdn.microsoft.com/cs-cz/library/bb397926.aspxMSDN web site/url.
Some useful examples of LINQ in C# on url=http://www.dotnetperls.com/linqDotNetPerls/url

:idea: See attached example for more details about Linq in SDF.
Attachments
Linq.cls
(39.68 KiB) Downloaded 482 times
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!

PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

Re: LINQ

Postby PetrS » 03 Apr 2015, 11:56

Some examples of LINQ capabilities:

buGet maximum normal force from all combinations on Section:/u/b
code
double Max = Linq.Max(IO.Section.InternalForces.Values, F=>F.N);
/code


buSelect all combinations with positive bending moment My:/u/b
code
object CombiWithMy = Linq.Where(IO.Section.InternalForces.Values, F=>F.My>0);
/code


buCalculate normal stress from all combinations on Section:/u/b
code
object Sigmas = Linq.Select(IO.Section.InternalForces.Values, F=>F.N/A+F.My/Wy+F.Mz/Wz);
/code
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!

PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

Re: LINQ

Postby PetrS » 17 Sep 2015, 12:05

buGet maximum values of N, My, Mz on current section:/u/b
code
double SectionNmax = Linq.Max(IO.Section.InternalForces.Values, object Combi=>Combi.N);
double SectionMymax = Linq.Max(IO.Section.InternalForces.Values, object Combi=>Combi.My);
double SectionMzmax = Linq.Max(IO.Section.InternalForces.Values, object Combi=>Combi.Mz);
/code

buGet maximum values of N, My, Mz on whole beam:/u/b
code
double MemberNmax = Linq.Max(IO.Beam.Section, object Section=>Linq.Max(Section.InternalForces.Values, object Combi=>Combi.N));
double MemberMymax = Linq.Max(IO.Beam.Section, object Section=>Linq.Max(Section.InternalForces.Values, object Combi=>Combi.My));
double MemberMzmax = Linq.Max(IO.Beam.Section, object Section=>Linq.Max(Section.InternalForces.Values, object Combi=>Combi.Mz));

/code

buGet all critical combinations on current section:/u/b
code
object CriticalCombisOnSection = Linq.ToList(Linq.Where(IO.Section.InternalForces.Values, object Combi=>Combi.IsCritical));
/code
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!


Return to “Design forms features”

Who is online

Users browsing this forum: No registered users and 3 guests