Code Red > .NET

(vent) Introduction to LINQ

(1/5) > >>

JohnK:
So I've been using my trial of PluralSight and watching some C# stuff. I am now absolutely convinced that the C# development team is either drunk or the language is an April fools joke gone bad.

Granted, I realize this is just an intro and the author said as much but...


--- Code - C#: ---namespace IntroToLINQ {    [TestClass]    public class IntroToLINQ {         [TestMethod]        public void Scratchpad() {             List<string> names = new List<string> {                "Rob, Friend",                "Holly, Family",                "This isn't a name",                "Macolm, Colleague",                "Tom, Family"            };             Regex pattern = new Regex( "([^,]*), (.*)" );             var query = from line in names                        let match = pattern.Match( line )                        where match.Success                        select new {                            Name = match.Groups[1].Value,                            Relationship = match.Groups[2].Value                        } into association                        group association.Name by association.Relationship;             foreach( var group in query ) {                Console.WriteLine( "Relationship: {0}", group.Key );                foreach( var name in group ) {                    Console.WriteLine( "   {0}", name );                }            }        }    }} 

kdub_nz:

Where is your problem John ?

Syntax or mechanics ?

PS. which course ?



Relationship: Friend
   Rob
Relationship: Family
   Holly
   Tom
Relationship: Colleague
   Macolm

JohnK:
Mostly mechanics; the ability to mix in Sql statements is a bit of a much for me--added with that all the inferencing (compile/run time). I guess just feeling overwhelmed again (all the syntax tricks and shortcuts I'm picking up are making the language and my interpretation of those sugar laced calls feel under developed).

I'll get you the name in the morning but this was supposed to be a quick c# refresher for me. I essentially finished the course but I am going to go back and take notes before I say I am officially done. The course is by Jon Skeet and Rob Conery. My next course was going to be the advanced courses from them.

Side note: I'm also looking at Swift as well, and so far I like the language.

kdub_nz:

I assume that would be 

Exploring C# 6 with Jon Skeet which only mentions LINQ in passing.

There were some (several) LINQ courses by Scott Allen dated around 2008 which take us through from beginner to advanced.

John,
Did you know that LINQ can be used with success on the AutoCAD database ?

kdub_nz:

--- Quote from: John Kaul (Se7en) on January 13, 2016, 09:55:37 PM ---
Side note: I'm also looking at Swift as well, and so far I like the language.

--- End quote ---

I can't make the time to look at iOS, OSX specific languages unfortunately.

... and my brain isn't what it used to be :-(

Navigation

[0] Message Index

[#] Next page

Go to full version