?
SolvedPrivate

select last linq and lambda

Posted on 2014-04-23
4
Medium Priority
?
69 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn different types of Android Layout and some basics of an Android App.
Simple Linear Regression
Six Sigma Control Plans

762 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