?
SolvedPrivate

select last linq and lambda

Posted on 2014-04-23
4
Medium Priority
?
73 Views
Last Modified: 2016-02-15
I have a list that is populated continuously
I need to find the last entry and see if it is one of my strings
 Program.myMainControl.dtoc.wordList <- my list
var listofIns = new[]{ "AXGRMS","LATGRMS","AXSHK","LATSHK","AXROT","LATROT"}; <- what I am looking for


how do I  do that with linq?
0
Comment
Question by:r3nder
  • 3
4 Comments
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 2000 total points
ID: 40018675
Does this work for you?

        string[] list = new string[] { "one", "two", "three", "last" };
        string last = list.Last<string>();

Open in new window

0
 
LVL 6

Author Comment

by:r3nder
ID: 40018780
The list
var listofIns = new[]{ "AXGRMS","LATGRMS","AXSHK","LATSHK","AXROT","LATROT"};
are the strings I am looking for in the wordlist.thelabel
the struct is below for the wordlist

public struct datawords
        {
            public DateTime thetime { get; set; }
            public string thelabel { get; set; }
            public float thevalue { get; set; }
        }
public BindingList<datawords> wordList = new BindingList<datawords>();
0
 
LVL 6

Author Comment

by:r3nder
ID: 40018819
got it
SVType = Program.myMainControl.dtoc.wordList.Last().thelabel;
                new_SVValue = Program.myMainControl.dtoc.wordList.Last().thevalue;
0
 
LVL 6

Author Closing Comment

by:r3nder
ID: 40018822
Thanks when I saw what you wrote I figured it out.....:D
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Screencast - Getting to Know the Pipeline

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question