Is there a way of changing what property a Linq statement does a Where and an OrderBy please?  I have the following example function that I am trying to make more flexible:  public static List&lt;SADatastore.SA_Items&gt; BuildResourcesModel2(         int Take = 10000,         int Skip = 0,         string filterBy = null,         string filterString = null,         string sortBy = "ItemID",         string sortOrder = "asc"         ) {          List&lt;SADatastore.SA_Items&gt; theAnswer = new List&lt;SA_Items&gt;();          using (SADatastoreEntities db = new SADatastoreEntities(Properties.Settings.Default.ConnectionString)) {             theAnswer = db.SA_Items                         .Where(x =&gt; x.SA_Categories.Description.ToLower().Contains(filterString.ToLower()))                         .OrderBy(x=&gt;x.ItemID)                         .Take(Take)                         .Skip(Skip)                         .ToList();         }          return theAnswer;     }   As you can see, as it's written at the moment, it is always doing the where based on the Category Description and Ordering Ascending based on ItemID  Is there a way to rewrite this in a dynamic way so if it's called with the parameters  filterBy = "Manufacturer" filterString "Ford" sortBy = "Manufacturer" sortOder = "Desc"   It would dynamically change the Where and Order clauses?  Any help would be greatly appreciated!
I found an example in the  for Dynamic LINQ that allows you to use a sql-like string (e.g. OrderBy("Name, Age DESC")) for ordering. Unfortunately, the method included only works on IQueryable&lt;T&gt;. Is there any way to get this functionality on IEnumerable&lt;T&gt;?
Check if all elements in a list are identical I am trying to INSERT INTO a table using the input from another table. Although this is entirely feasible for many database engines, I always seem to struggle to remember the correct syntax for the SQL engine of the day (, , , , and ).  Is there a silver-bullet syntax coming from an SQL standard (for example, ) that would allow me to insert the values without worrying about the underlying database? Broken "Network profile" link when Area51 is their only account How to create a folder in HOME Folder with ModelBuilder in ArcGis 10? How was Nearly Headless Nick unpetrified? Check for Process if Same is Running Is there a script or a way in linux that when I try to execute a shell script/process, if the same is running, it will prompt that same is running and will exit otherwise it will continue. If $g \circ f$ is surjective, show that $f$ does not have to be surjective? When used like this:  import static com.showboy.Myclass;  public class Anotherclass{}   what's the difference between import static com.showboy.Myclass and import com.showboy.Myclass? Why did Hogwarts Library carry a book containing information on horcruxes if it was a banned subject? I have a large set of data points of the form (mean, stdev). I wish to reduce this to a single (better) mean, and a (hopefully) smaller standard deviation.  Clearly I could simply compute $\frac{\sum data_{mean}}{N}$, however this does not take in to account the fact that some of the data points are significantly more accurate than others.  To put it simply, I wish to preform a weighted average of these data points, but do not know what the weighting function should be in terms of the standard deviation. Exception messages in English? What's the easiest way to figure out if a window is opened modally or not?  CLARIFICATION:  I open a window calling   myWindow.ShowDialog();   I have a footer with an "OK" &amp; "Cancel" button that I only want to show if the window is opened modally. Now I realize I can set a property by doing this:  myWindow.IsModal = true; myWindow.ShowDialog();   But I want the window itself to make that determination. I want to check in the Loaded event of the window whether or not it is modal.  UPDATE  The IsModal property doesn't actually exist in a WPF window. It's a property that I have created. ShowDialog() blocks the current thread.   I'm guessing I can determine if the Window is opened via ShowDialog() by checking if the current thread is blocked. How would I go about doing that? Can't log in using Firefox in Stack Overflow Sobolev inequality If $f\in H^2(\mathbb R^2)$, I want to show that    $||f||_{L^\infty}\le c||f||_{H^2}$ $||f||_{L^\infty}\le c||f||_{H^1} [1+\ln(1+||f||_{H^2})]$   For 1, I use $||f||_{L^\infty}\le \sup_{x\in \mathbb R^2} |f|\le\int_{\mathbb R^2} |\hat f(\xi)|d\xi = \int(1+|\xi|^2)^{-1}(1+|\xi|^2)|\hat f(\xi)|d\xi \le (\int (1+|\xi|^2)^{-2}d\xi)^2(\text {which is integrable in this case})||f||_{H^2}\to \text{is this correct?}$   But for 2, I am stucked. How can I get the "ln"? and how can I make it into a product of $H^1$ and $H^2$ norm? Light Presets .exr I would like to install light presets for Blender to automate my lightning in my scenes. I have some .exr files (from Greyscalegorilla) but I don't know how to do it on Blender to make it work. Can someone help me? Thank you What is the proof that given a set of $n$ elements there are $2^n$ possible subsets (including the empty-set and the original set). In the current era of cricket, we see batsmen using switch hits to play a ball. That is, while playing a ball they change their batting side (left to right handed and vice versa) just before the ball comes to them.  My question is, can a bowler bowl a switch ball? Meaning, can a left hand bowler bowl right handed to a batsman? If it is not permitted, then is it not unfair to the bowlers that batsmen can change their batting style but not the bowlers? Or are there are any rules against a switch hit? Bottom of tool shelf grayed out I have lost functionality in the tool shelf. When I click on a selector or something in the bottom part of the tool self that you can hide and unhide, nothing happens. I can see the options but when I click it doesn't work. See screenshot where it says "Add Cylinder". I'm doing some exercises on Apostol's calculus, on the floor function. Now, he doesn't give an explicit definition of $[x]$, so I'm going with this one:     DEFINITION Given  $x\in \Bbb R$, the integer part of $x$ is the unique $z\in \Bbb Z$ such that $$z\leq x &lt; z+1$$ and we denote it by $[x]$.   Now he asks to prove some basic things about it, such as: if $n\in \Bbb Z$, then $[x+n]=[x]+n$  So I proved it like this: Let $z=[x+n]$ and $z'=[x]$. Then we have that  $$z\leq x+n&lt;z+1$$  $$z'\leq x&lt;z'+1$$  Then $$z'+n\leq x+n&lt;z'+n+1$$  But since $z'$ is an integer, so is $z'+n$. Since $z$ is unique, it must be that $z'+n=z$.  However, this doesn't seem to get me anywhere to prove that  $$\left[ {2x} \right] = \left[ x \right] + \left[ {x + \frac{1}{2}} \right]$$  in and in general that   $$\left[ {nx} \right] = \sum\limits_{k = 0}^{n - 1} {\left[ {x + \frac{k}{n}} \right]} $$  Obviously one could do an informal proof thinking about "the carries", but that's not the idea, let alone how tedious it would be. Maybe there is some easier or clearer characterization of $[x]$ in terms of $x$ to work this out.  Another property is $$[-x]=\begin{cases}-[x]\text{ ; if }x\in \Bbb Z \cr-[x]-1 \text{ ; otherwise}\end{cases}$$  I argue: if $x\in\Bbb Z$, it is clear $[x]=x$. Then $-[x]=-x$, and $-[x]\in \Bbb Z$ so $[-[x]]=-[x]=[-x]$. For the other, I guess one could say:  $$n \leqslant x &lt; n + 1 \Rightarrow  - n - 1 &lt; x \leqslant -n$$  and since $x$ is not an integer, this should be the same as $$ - n - 1 \leqslant -x &lt; -n$$  $$ - n - 1 \leqslant -x &lt; (-n-1)+1$$  So $[-x]=-[x]-1$ Difference between == and === in JavaScript