PdfPrep.com

How should you complete the relevant code?

DRAG DROP

You are developing a class named ExtensionMethods.

You need to ensure that the ExtensionMethods class implements the IsEmail() method on string objects.

How should you complete the relevant code? (To answer, drag the appropriate code segments to the correct locations in the answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

Answer:

Explanation:

Extensions must be in a static class as it kind of a shared source of extension methods. You do not instantiate the class.

The key word “this” is simply a syntax how you tell the compiler, that your method IsUrl is extension for the String object

Exit mobile version