Edit:  Of course my real code doesn't look exactly like this. I tried to write semi-pseudo code to make it more clear of whay I wanted to do.  Looks like it just messed things up instead.  So, what I actually would like to do is this:  Method&lt;Interface1&gt;(); Method&lt;Interface2&gt;(); Method&lt;Interface3&gt;(); ...   Well ... I thought that maybe I could turn it into a loop using reflection. So the question is: How how do I do it. I have very shallow knowledge of reflection. So code examples would be great.  The scenario looks like this:  public void Method&lt;T&gt;() where T : class {} public void AnotherMethod() {     Assembly assembly = Assembly.GetExecutingAssembly();      var interfaces = from i in assembly.GetTypes()     where i.Namespace == "MyNamespace.Interface" // only interfaces stored here     select i;      foreach(var i in interfaces)     {         Method&lt;i&gt;(); // Get compile error here!     }       Original post:  Hi!  I'm trying to loop through all interfaces in a namespace and send them as arguments to a generic method like this:  public void Method&lt;T&gt;() where T : class {} public void AnotherMethod() {     Assembly assembly = Assembly.GetExecutingAssembly();      var interfaces = from i in assembly.GetTypes()     where i.Namespace == "MyNamespace.Interface" // only interfaces stored here     select i;      foreach(var interface in interfaces)     {         Method&lt;interface&gt;(); // Get compile error here!     } }   The error I get is "Type name expected, but local variable name found". If I try  ...     foreach(var interface in interfaces)     {         Method&lt;interface.MakeGenericType()&gt;(); // Still get compile error here!     } }   I get "Cannot apply operator '&lt;' to operands of type 'method group' and 'System.Type'" Any idea on how to get around this problem?
What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime?  Consider the following sample code - inside the Example() method, what's the most concise way to invoke GenericMethod&lt;T&gt;() using the Type stored in the myType variable?  public class Sample {     public void Example(string typeName)     {         Type myType = FindType(typeName);          // What goes here to call GenericMethod&lt;T&gt;()?         GenericMethod&lt;myType&gt;(); // This doesn't work          // What changes to call StaticMethod&lt;T&gt;()?         Sample.StaticMethod&lt;myType&gt;(); // This also doesn't work     }      public void GenericMethod&lt;T&gt;()     {         // ...     }      public static void StaticMethod&lt;T&gt;()     {         //...     } }
multiplicative group of infinite fields Blank image when I render Could someone with experience in using these exercise typesetting packages please offer a quick compare and contrast of these packages to help me choose?  Packages under consideration are:         Having read briefly the documentation, they all seem to do the same thing generally, so could you please focus on the differences?  Some differences will not be obvious until I've learnt and used all the different packages but I want to better appreciate the differences now, a priori. Filtering questions by multiple tags I know you can select a tag and then click on unanswered to view the unanswered questions for that tag.  But is there a way to view questions only for a certain set of tags > 1 tag?  Mainly I'd like the union of tag1 with tag2 with tag3 with tag4. But also the intersection of tags would be nice as well. Is there an easy way to change filetype association? After the upgrade to 11.10 I've had the problems that    all music-files would open with banshee, which then crashed all folders would open with konsole   The first problem I  after installation of "ubuntu tweak" "> admin > filetype Associations".. Changed back to totem.  The second was somehow not accessible this way (did not give any possibility to add commands).  I've changed the line "inode/directory=nautilus-folder-hanlder.desktop" to "inode/directory=nautilus.desktop" from "/usr/share/applications/defaults.list" and now everything works fine.  Question: More convenient ways to do that? How do you do AppBar docking (to screen edge, like WinAmp) in WPF? Let's get rid of the 10K flag queue are pretty cool... You get a birds-eye view of activity on the site, a &quot;dashboard&quot; view of what's happening. Some of the individual tools haven't scaled particularly well with Stack Overflow's growth, but the concept behind them is still sound: we trust you to enough to be a bee watcher now.  ...and then there's . What a let-down! Once upon a time, this queue contained spam and offensive flags, which one might reasonably assume were important enough to put in front of the more trusted members of the site. Re-flagging them brought them that much closer to deletion, while editing them offered salvation to some hapless author. Nowadays, it's a bunch of Not an Answer flags and a smattering of assorted cruft. 10K users can't even vote to delete these; only 20K users have that privilege. Re-flagging them does nothing but increase their priority in the moderator flag queue, where they frequently outrank more pressing issues;  has . Also, it's , and the behavior has diverged far enough from that of the moderator flag queue on which it is based that it has become an active hindrance to further development of the tooling there. Worst of all, we have  that's available to anyone with the editing privilege. It even has logic built in to prioritize answers likely to be deleted for users with . It's like we gave you a car for your 10th birthday, and then replaced it with a rusty bicycle when you turned 16. It was a nice idea, but it has outlived its usefulness. Proposed changes The /tools/flagged route goes away. Period. No replacement. The rest of the 10K tools stick around as informational pages. Not an Answer flags go into /review/low-quality, . Then we beef up the Low Quality review process to make better use of more experienced reviewers and solve this whole &quot;declined / helpful / disputed&quot; flag debate once and for all:  Effective # of reviews required == ReviewsRequired + # of applicable flags (where ReviewsRequired is 2 on Stack Overflow, 1 everywhere else). So 1 VLQ or NAA flag means EffectiveReviewsRequired=3. LQ tasks are not dequeued until one of the following conditions is met:  Post is edited from within review. Outcome: flags are marked &quot;helpful&quot; (current behavior). Post accumulates 3 Delete votes (can only happen when post scores &lt;= 0 and reviewers have &gt;= 20K rep). Outcome: post is deleted, flags are marked &quot;helpful&quot;. Task accumulates EffectiveReviewsRequired &quot;Looks Good&quot; reviews. Outcome: if the number of (Recommend)Delete reviews is &gt;= the number of Looks Good reviews, mark flags &quot;disputed&quot; and raise DisputedLowQuality mod flag. Otherwise, mark flags &quot;declined&quot;. Task accumulates 6* RecommendDelete + Delete reviews. Outcome: mark flags &quot;helpful&quot;. If the post scores &gt; 0 then raise DisputedLowQuality mod flag, else just delete post (current behavior).   As under the current system, flags on posts that've already completed one full review cycle without being deleted should skip /review and go directly into the mod queue.  End result  Flags get handled faster, more accurately, and with less wasted effort from 10K reviewers. Moderators are free to focus on situations that can't be handled by the community - the ! Developers are free to make enhancements to the moderator tooling without having to work around 10K user restrictions.  Questions Am I forgetting anything here? I haven't really spent much time in the 10K flag queue since back when it was filled with spam flags and therefore useful - is there a use-case that you depend on that would be lost with its removal? Post 'em below. *: on Stack Overflow, only . In Python, how do I determine if an object is iterable? Inversion in "only [adverb] have they" I have seen this construction quite often:      Online ads have been around since the dawn of the Web, but only in   recent years have they become the rapturous life dream of Silicon   Valley.   What is the rule there?. When your sentence doesn't start with pronoun + verb, invert them as verb + pronoun?. I know it sounds awkward but is it possible (grammatically correct) to use something similar to:      Online ads have been around since the dawn of the Web, but only in   recent years they have become...   And in any case, does this only work with have (or has)? Maybe it works fine with 'had' but I can't think of an example right now. What are the differences between an Ubuntu Long Term Support release (LTS) and a normal release? Zorn's Lemma states that if every chain $C$ in a partially ordered set $X$ has an upper bound then there is at least one maximal element in $X$.  Let $n\in \mathbb{N}$, $C_n \subset \mathbb{N}$ be the set containing the natural numbers $\{1,\dots,n\}$. Then if $k\le n$, $C_k\subset C_n$, so $C_n$ is a chain. Also, $C_n$ has an upper bound, such as $n+1$. But what is the maximal element of $\mathbb{N}$?  There's something I don't get in Zorn's Lemma statement. How do I get an operating system onto a new hard drive? Why do rainbows have distinct colors? When I searched on the Internet for the reason of formation of , I got many explanations like  one &amp; . All the explanations consider only one spherical water droplet (like ).  Why don't the refracted waves coming from the adjacent droplets interfere with each other? For example, why doesn't a red ray coincide with a violet ray coming from another droplet at a suitable position?   How are we able to see rainbows with distinct colors? Since there are thousands of raindrops in the sky when it is raining, shouldn't it be a mess due to overlapping of different wavelengths?  Please explain. Creating a gradient-based legend I have a map with graduated symbology, with 328 unique values. I would like to add a legend to my map (as in the picture), illustrating that light blue indicates low values and dark blue high values.  I have done this in ArcGIS before. Is there a way to do this in QGIS as well? Radical of $\mathfrak{gl}_n$ Why does inertia happen? In  R P Feynman relates a story where his father told him that, even though we know the word "inertia" and what it means, nobody knows why inertia happens. Is that still true? Do Fortnite V-Bucks Purchases Save on All Platforms? So I'm thinking of buying some V-Bucks on Fortnite, Battle Royale mobile. Do the purchases save cross platform? How to create a Wi-Fi Hotspot (in Access Point mode)? Prove the inequality $|xy|\leq\frac{1}{2}(x^2+y^2)$ For about 2 days I'm trying to configure Ubuntu so that I can send an email, but when I type in:  echo "Subject: sendmail test" | sendmail -v my@email.com   I'll get:  postdrop: warning: unable to look up public/pickup: No such file or directory Mail Delivery Status Report will be mailed to &lt;andreigbr&gt;.   Even if I change my@email with mine, the inbox will be empty. Can somebody help me, please? I watched about 5 tutorial about how to send an email fom the command line but still doesn't work.