Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. AND and OR with expressions

AND and OR with expressions

Scheduled Pinned Locked Moved C#
helpquestioncsharphtmllinq
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    enginco
    wrote on last edited by
    #1

    http://www.albahari.com/nutshell/predicatebuilder.html[^] I found a link about expressions. Can someone explain that how can I use? Is it helpfully? or are there any idea for my problem with LINQ and expressions? (please don't say REGEX) :) I have a class like this:

        public class SearchWord
        {
          ...  
          public string Search\_key { get; set; }
          public string And\_key { get; set; }
          public string Not\_key { get; set; }
          ...
          ...
        }
    

    SearchWord sw1 = {Search_key = "test", And_key = "", Not_key = ""}; SearchWord sw2 = {Search_key = "test", And_key = "email", Not_key = ""}; SearchWord sw3 = {Search_key = "test", And_key = "email", Not_key = "engin"}; I have a big text: string forSearch = "test hkkdkh yrfjkdh ggshdj bla bla bla email bla bla sdkj engin"; there are 4 case for my situation: test = returns bool test and email = returns bool test and engin = returns bool test and email and engin = returns bool Now, I want to compare this 4 result and return SearchWord(if result = true) Please help me...

    CPalliniC 1 Reply Last reply
    0
    • E enginco

      http://www.albahari.com/nutshell/predicatebuilder.html[^] I found a link about expressions. Can someone explain that how can I use? Is it helpfully? or are there any idea for my problem with LINQ and expressions? (please don't say REGEX) :) I have a class like this:

          public class SearchWord
          {
            ...  
            public string Search\_key { get; set; }
            public string And\_key { get; set; }
            public string Not\_key { get; set; }
            ...
            ...
          }
      

      SearchWord sw1 = {Search_key = "test", And_key = "", Not_key = ""}; SearchWord sw2 = {Search_key = "test", And_key = "email", Not_key = ""}; SearchWord sw3 = {Search_key = "test", And_key = "email", Not_key = "engin"}; I have a big text: string forSearch = "test hkkdkh yrfjkdh ggshdj bla bla bla email bla bla sdkj engin"; there are 4 case for my situation: test = returns bool test and email = returns bool test and engin = returns bool test and email and engin = returns bool Now, I want to compare this 4 result and return SearchWord(if result = true) Please help me...

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      enginço wrote:

      please don't say REGEX

      Uhmmmmmmm...Regex? :-D

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      E 1 Reply Last reply
      0
      • CPalliniC CPallini

        enginço wrote:

        please don't say REGEX

        Uhmmmmmmm...Regex? :-D

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        E Offline
        E Offline
        enginco
        wrote on last edited by
        #3

        Yeahhh, finally I solved my problem with expressions and linq. There is no REGEX :-\ thanx o'relly books

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups