i have very basic doubt - from performance point of view "is" cast or "as" cast is better to use. Though "as" does not throw exception but it does boxing and hence performance gets affected but still not sure.  if possible please give example for this
When programming interfaces, I've found I'm doing a lot of casting or object type conversion.  Is there a difference between these two methods of conversion?  If so, is there a cost difference or how does this affect my program?  public interface IMyInterface {     void AMethod(); }  public class MyClass : IMyInterface {     public void AMethod()     {        //Do work     }      // Other helper methods.... }  public class Implementation {     IMyInterface _MyObj;     MyClass _myCls1;     MyClass _myCls2;      public Implementation()     {         _MyObj = new MyClass();          // What is the difference here:         _myCls1 = (MyClass)_MyObj;         _myCls2 = (_MyObj as MyClass);     } }   Also, what is "in general" the preferred method?
I recently upgraded to Windows 8 from Win 7 64 bit and have started to encounter a strange issue. When I have any program running which plays sound, such as a game or spotify, after a random interval (usually around 5-10 minutes) the program sound will set itself really low.    If I Alt-Tab to the desktop and check the Mixer I can see that the Application volume has automatically set itself really low - the other volume levels (i.e. the Device speakers) stay the same.  I'm able to just set the application volume back to a reasonable level and it stays that way for another 5 - 10 minutes then goes quiet again.  My sound is Realtek High Definition Audio and my machine is an Acer Aspire 5738G if that helps in any way.  Any help much appreciated! How to iterate over a comma separated list? Six simple tips to get Stack Overflow reputation fast From "6 Simple Tips to Get Stackoverflow Reputation Fast" at codexon.com:   Be the First to Answer. Even at the cost of quality. Use Downvotes and Comments Strategically Use obnoxious in-your-face formatting and lists. Be Aware of the 200 rep/day Limit Edit, But Don’t Edit Too Much Associate your other accounts   Courtesy of . Agree? Disagree? Walnuts? Cantaloupe? Which is the easiest way to evaluate $\int \limits_{0}^{\pi/2} (\sqrt{\tan x} +\sqrt{\cot x})$? How do I insert a nice tilde that is centered in the middle in a lstlisting? I found another thread about  but I can't apply it because the method described there only works outside of lstlisting as lstlisting displays all the text literally. Any ideas?  Here is how the tilde looks in my document at the moment - it's at the very top of the font and I would like it to be in the middle (like ~ this).    Here is the LaTeX for this fragment:  \section{Remove duplicate, consecutive lines (emulate "uniq")}  \begin{lstlisting} awk 'a !~ $0; { a = $0 }' \end{lstlisting}  Variables in Awk don't need to be initialized or declared before they are being used. The pronunciation of words which begins 'con' and 'com' Show that $\mathbb{Q}(\zeta_n)$ is Galois over $\mathbb{Q}$ and $Gal(\mathbb{Q}(\zeta_n)/\mathbb{Q}))\cong \mathbb{Z_n}^*$ Question 1: For $n \in \mathbb{N}$ explain why $\mathbb{Q}(\zeta_n)$ is Galois over $\mathbb{Q}$   We must show that it is normal and separable.   $\mathbb{Q}(\zeta_n)/\mathbb{Q}$ is normal since it is a splitting field for $X^n-1 \in\mathbb{Q}[X]$ (I think... Is this correct?).  It is separable because it is of characteristic $0$  Question 2: $Gal(\mathbb{Q}(\zeta_n)/\mathbb{Q}))\cong \mathbb{Z_n}^*$  Is this because the primitive nth root of unity $\zeta_n$ acts as a generator for a cyclic group? I am unable to fill out a decent proof on this.   Thanks for your help Is Canon 60D still a decent camera? I have a Canon 60D, bought it back in 2013. Use it quite a while, but in past two-three years, I lost interest in photography. I will be going on a long trip this summer and would like to take a decent camera with me. Is Canon 60D still a decent one or I will be missing on features and upgrades comparing to the latest versions?  In terms of lenses I own Tamron 24-70 2.8 And Canon 100 2.8 Macro. I've been studying the Huddleston and Pullum book for four months now. So far only one thing confuses me: the identity of gerund. Is it a noun or a verb?        His constant smoking upset me.  smoking seems  noun because of adjective constant.   Him/His constantly smoking upset me. smoking seems to be verb because of adverb constantly.   Him/His smoking cigars upset me. smoking seems to be a verb because of object cigars.      "His smoking upset me." So is this smoking gerund a noun or verb? Because there is no differentiation, is it both verb and noun? Maybe it's new word category?  Also his seems to be both  sometimes a subject and at other times a possessive determiner. Is that correct? What is the point of stacking favorite notifications? I noticed I have more notifications than favorites, which means that the notifications are stacked (in other words, there can be more than 1 notification per question).    Here is my reasoning:   Why do they add up?, I don't know where is the benefit of knowing that some of the questions had multiple changes if we are not able to see which questions had how many changes   Since we don't know what questions had what amount of changes, the amount of notifications is just a meaningless number that don't help us too much. Here are some possible solutions:   Add a max of 1 notification per question Keep the same number, but allow us to see how many new changes there were on every question I am trying to add jQuery to my page (it is not being added by default). The file is adding to the page but after drupal.js causing the error:  SCRIPT5009: 'jQuery' is undefined  drupal.js, line 5 character 1    The code that adds drupal.js to the page in common.inc  ... 'misc/drupal.js' =&gt; array(           'data' =&gt; 'misc/drupal.js',           'type' =&gt; 'file',           'scope' =&gt; 'header',           'group' =&gt; JS_LIBRARY,           'every_page' =&gt; TRUE,           'weight' =&gt; -1,           'preprocess' =&gt; TRUE,           'cache' =&gt; TRUE,           'defer' =&gt; FALSE,         ), ...   In my module hook_init I have:    drupal_add_js('misc/jquery.js', array(     'group' =&gt; JS_LIBRARY,     'weight' =&gt; -20,     'cache' =&gt; TRUE,   ));   I would think with a lower weight it would load before drupal.js?  The header of the page contains the following scripts:  &lt;script type="text/javascript" src="http://mysite.com/misc/drupal.js?mqdxrf"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://mysite.com/misc/jquery.js?mqdxrf"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://mysite.com/misc/jquery.once.js?mqdxrf"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://mysite.com/sites/default/files/languages/nl_c9aC92_wtuULa79-hTFcGPM53oqk1yKwciOa_Q3yO28.js?mqdxrf"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://mysite.com/sites/all/modules/lang_dropdown/msdropdown/jquery.dd.js?mqdxrf"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://mysite.com/sites/all/modules/lang_dropdown/lang_dropdown.js?mqdxrf"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://mysite.com/sites/all/modules/devel/devel_krumo_path.js?mqdxrf"&gt;&lt;/script&gt; During kill Bill, we learn that all the black mamba had to do to get Hanzo to build her a sword, was to mention Bill's name.  When black mamba meets Bill at the end, she tells him that all she did was mention his name. Bill responds with, "that'll do it!"  So what was it that Bill did to Hanzo to make him come out of retirement and make another weapon of death? Show that $a_n=\sin(n)$ does not converge     My idea:  Take two subsequences: $a_{n_k}=\sin(\frac {\pi k} 2)$ , $a_{n_l}=\sin(\frac {2\pi l} 3)$  So: $\forall n$ : $\lim_{n\to\infty} a_{n_k}=1$, $\lim_{n\to\infty} a_{n_l}=-1$  So two inifinite subsequence converge to different limits thus the sequence $a_n$ doesn't converge.   Is that correct ?  Edit:   The contrapositive of the defintion of a limit of a sequence:   $\exists\epsilon&gt;0 : \forall n\in N : \exists n&gt;N \Rightarrow |x_n-L|&gt;\epsilon$  Take $\epsilon =1$ and we know that $\sin(n)$ is bounded so lets take it's supermum: 1  $|1-1|&gt;\epsilon=1\Rightarrow 0&gt;1 \Rightarrow$ Contradiction. Can open sets and closed sets of $\mathbb{R}^n$ be homeomorphic? Suppose $A$ is an open subset of $\mathbb{R}^n$ considered as a topological subspace. Suppose $B$ is a another susbet of $\mathbb{R}^n$, and under the induced topology, is homeomorphic to $A$.  If $B$ is closed and bounded, then by the Heine-Borel theorem, $B$ is compact as a topological space so $A$ and $B$ cannot be homeomorhpic, because $A$ is not compact. But if $B$ is not bounded, what can be said about $B$, if any? Must $B$ be open, can it ever be closed (let's leave out the only case of being both open and closed--the entire ambient space $\mathbb{R}^n$), or can it be neither open nor closed? Indicate How Trustworthy the UpVotes Are Famously:     "Try not. Do or do not. There is no try."           -- Yoda   Thing is, this is from a movie. A writer wrote it and a voice actor spoke it. Is there a correct form of attribution for a case like this? If so, what? Query Feature and Usage based entitlements license I need to query programmatically the Feature license and usage-based license which is available in UI. Could someone please highlight if we can query the same or is it available in UI only, Thanks. Finding a 2x2 Matrix raised to the power of 1000 Take most recent (or concatenate) edit comments when editing during grace period Recently, I edited  to update a link to a better resource. I clicked "Save" without entering a description of the edit (edit #1).  Then I realised that the question was asked by a new user who may not be able to easily identify the change that was made. So I edited it again, this time only to add a detailed edit description (edit #2).  Since edit #2 was made during the grace period (within 5 minutes of edit #1), the system has merged them into a single edit, but only the edit comment from edit #1 was recorded in the revision history, whereas edit #2's comment was simply discarded/ignored.  I'd suggest that either the most recent (non-default) edit comment is taken or that the comments are concatenated to provide a more useful edit history What Lagrangian counterterms might be needed in a $\phi^ 6$ theory in 3D?