SolvedPrivate

select last linq and lambda

Posted on 2014-04-23
4
63 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 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

773 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