Computers, Programming, Technology, Music, Literature

Archive for May 2013

Visual Studio 2010 – Step into (F11) a property – How?

leave a comment »

 

I don’t think the internet hates redundancy.

So, How to Step into (F11) a property or an operator in Visual Studio (2010)? Answer borrowed directly from http://stackoverflow.com/questions/4873225/visual-studio-2010-step-into-property-functionf11-doesnt-work-as-expected.

 

 

In VS 2010 it is the default setting that you step over properties and operators(like F10) even if you want to step into(F11). So here is the solution:

  • Go to Tools > Options menu in Visual Studio.
  • Go to Debugging > General menu item in left pane.
  • In right view you will see an option Step over properties and operators (Managed only). Uncheck this option and then you are all set.

enter image description here

Finally found it here: http://www.netomatix.com/post/2010/06/25/Enable-step-into-properties-in-Visual-Studio-Debugger.aspx

Advertisements

Written by gmaran23

May 28, 2013 at 2:30 pm

Posted in .Net, C#

Tagged with , , ,

C# – if we didn’t have the is keyword

leave a comment »

 

I am so fixated with the as keyword these days, that I forgot how I’d do a type comparison if the as keyword never existed. We’d have to use a combination of myobj.GetType() and the typeof operator.

            try
            {
                smtpClient.Send(mailMessage);
            }
            catch (Exception eX)
            {
                if (eX is SmtpFailedRecipientException)
                {
                    Console.WriteLine("SmtpFailedRecipientException is thrown.");
                }
                else if (eX.GetType() == typeof(SmtpException))
                {
                    Console.WriteLine("SmtpException is thrown.");
                }
                else
                {
                    Console.WriteLine("{0} is thrown.", eX.GetType().ToString());
                }
            }

Written by gmaran23

May 28, 2013 at 11:59 am

Posted in .Net, C#

Tagged with , , ,