PrepAway - Latest Free Exam Questions & Answers

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() extension 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 are
a. 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.)

PrepAway - Latest Free Exam Questions & Answers

Answer:

3 Comments on “How should you complete the relevant code?

  1. Lord Vader says:

    Extension methods are defined as static classes and static methods. the first parameter of the methodis the type of the class that you want to add the extension method to. it must be marked with the this keyword.
    public static class STringExtensions {
    public static string ToRandomCase(this string text){}}

    u can then call it via text.ToRandomCase();




    1



    0

Leave a Reply