QUESTION 18You are writing code for a new method namedProcessvoid Draw(object o){}The code receives a parameter of typeobject. You need to cast this object into the typePolygon. At times,the value ofothat is passed to the method might not be a validPolygonvalue. You need to make sure thatthe code does not generate anySystem.InvalidCastExceptionerrors while doing the conversions.Which of the following lines of code should you use inside theDrawmethod to accomplish this goal?:CSection: Section B
Get answer to your question and much more
ExplanationExplanation/Reference:QUESTION 19You are writing code to handle events in your program. You define a delegate namedPolygonHandlerlikethis:public delegate void PolygonHandler(Polygonp);You also create a variable of thePolygonHandlertype as follows:PolygonHandler handler;Later in the program, you need to add a method namedCalculateAreato the method invocation list of thehandlervariable. The signature of theCalculateAreamethod matches the signature of thePolygonHandlermethod. Any code that you write should not affect any existing event-handling code. Giventhis restriction, which of the following code lines should you write?CSection: Section B
Get answer to your question and much more
ExplanationExplanation/Reference:QUESTION 20You are developing a C# application. You create a class of the nameWidget. You use some third-partylibraries, one of which also contains a class of the nameWidget. You need to make sure that using the