score:3

Accepted answer

you could also try this

    var listcoord = new list<coord>();

    dictionary<string, string> dict = new dictionary<string, string>();
    dict.add("a", "myvalues");


    listcoord.add(new coord
    {
            segment = "a",
    });

    listcoord.add(new coord
    {
      segment = "b",
    });

    listcoord.add(new coord
    {
       segment = "c",
    });

    list<coord> result = listcoord.where(cords => dict.containskey(cords.segment))
                         .tolist();

use containskey and/or containsvalues based on your requirement.

sample working available at dotnetfiddle

thanks for the catch @yacoub massad

score:7

this is the way to join list & dictionary (you will get only matching coords)

 list<coordnew> newlist = listcoord .join(strdictionary, 
                                 a => a.segment, //from listcoord
                                 b => b.key, //from strdictionary
                                 (a, b) => new coordnew() { 
                                      segment_dictionaryvalue = b.value
                                      //other values from list or dictionary
                                 }).tolist();

if you need coordnew as

class coordnew
{
    public string segment { get; set; }
    public string segment_dictionaryvalue { get; set; }
    public double startx { get; set; }
    public double starty { get; set; }
    public double endx { get; set; }
    public double endy { get; set; }
}

Related Query

More Query from same tag