title: Using Parameters in LINQ
body: <p>net. I have a doubt. How do we introduce user defined variables as parameters in where clause of a LINQ query. I am querying an XML file. Here is my code</p>
  
  <pre><code>    XElement books = XElement.Load(@"Friends.xml");
  
  var titles =
     from book in books.Elements("Friend")
     where (string)book.Element("Date") == "27" &amp;&amp; (string)book.Element("Month") == "05"
     select book.Element("Name");
  
  foreach (var title in titles)
     Console.WriteLine(title.Value);
  </code></pre>
  
  <p>Instead of harcoding values <code>27</code> and <code>05</code>, I want to use variables instead.How to use them?</p>
  
  <p>Sorry for the dumb question, I misunderstood the problem. Actually I am blocking certain dates in a calendar. Now using the </p>
  
  <pre><code>private void calendar1_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
          {....}
  </code></pre>
  
  <p>works only for non blocked dates. Since a particular day I tried with the variable was a blocked one, it wasn't working. Now please suggest me a solution for this. All I need is to click on a date(blocked or non blocked) and I have to run a event. Which event should I use??</p>