Jump to content

Search the Community

Showing results for tags 'Linq'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 1 result

  1. How i can filter List the data with Dictionary condition using linq. class Person { public string name { get; set; } public string subject { get; set; } public string type { get; set; } public int age { get; set; } } class Test { public void FindData() { // Create dictionary and add five keys and values. var conditionDictionary = new Dictionary<string, string>(); conditionDictionary.Add("subject", "english"); conditionDictionary.Add("type", "teacher"); List<Person> persons = new List<Person>(); persons.Add(new Person { name = "Rajul", subject = "math", type = "teacher", age = 20 }); persons.Add(new Person { name = "Jhon", subject = "english", type = "teacher", age = 25 }); persons.Add(new Person { name = "Nitin", subject = "english", type = "student", age = 21 }); persons.Add(new Person { name = "Sumit", subject = "english", type = "teacher", age = 26 }); persons.Add(new Person { name = "Komal", subject = "science", type = "student", age = 29 }); List<Person> filteredpersons = Filter(persons, conditionDictionary); } public List<Person> Filter(List<Person> persons, Dictionary<string, string> conditionDictionary) { /*TODO: can you suggest how to filter list data using linq with Distionary*/ var list = (from person in persons from condition in conditionDictionary select person).ToList(); return list; } }
×
×
  • Create New...