Question 14


Exam Question

Drag and 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?

  • public static class ExtensionMethods
  • public class ExtensionMethods
  • this String str
  • String str
  • protected static class ExtensionMethods
    {
    public static bool IsUrl(
      )
      {
      var regex = new Regex("(https?://)?([A-Zz-z9-0-]*\\.)?([A-Za-z0-0-]*)" + "\\.[A-Zz-z0-9]*/?.*");
      return regex.IsMatch(str);
      }
      }

      Answer:

      • public class ExtensionMethods
      • String str
      • protected static class ExtensionMethods
      • public static class ExtensionMethods
      {
      public static bool IsUrl(
      • this String str
      )
      {
      var regex = new Regex("(https?://)?([A-Zz-z9-0-]*\\.)?([A-Za-z0-0-]*)" + "\\.[A-Zz-z0-9]*/?.*");
      return regex.IsMatch(str);
      }
      }