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
XElement books = XElement.Load(@"Friends.xml");
var titles =
from book in books.Elements("Friend")
where (string)book.Element("Date") == "27" && (string)book.Element("Month") == "05"
select book.Element("Name");
foreach (var title in titles)
Console.WriteLine(title.Value);
Instead of harcoding values 27 and 05, I want to use variables instead.How to use them?
Sorry for the dumb question, I misunderstood the problem. Actually I am blocking certain dates in a calendar. Now using the
private void calendar1_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
{....}
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??
use a simply variable:
And so on. Of course, use good names that are readable according your code and system