DRAG DROP
You are developing a class named ExtensionMethods
You need to ensure that the ExtensionMethods class implements the IsUrl() 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.)
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 IsUrl() 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.)
1 and 3
Why 3? Should it not be 4? Someone please explain
the correct code would look like this:
public static class ExtensionMethods
{
public static bool IsUrl(this String str)
{…}
Explanation:
extensions must be in a static class as it kind of a shared source of extension methods. you dont 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. You can read it like:
14 and 50 almost the same.