PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You write the following code.
public delegate void FaxDocs(object sender, FaxArgs args);
You need to create an event that will invoke FaxDocs.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
public static event FaxDocs Fax;

B.
public static event Fax FaxDocs;

C.
public class FaxArgs : EventArgs {
private string coverPageInfo;
public FaxArgs(string coverInfo) {
this.coverPageInfo = coverPageInfo;
}
public string CoverPageInformation {
get {return this.coverPageInfo;}
}
}

D.
public class FaxArgs : EventArgs {
private sting coverPageinfo;
public string CoverPageInformation {
get {return this.coverPageInfo;}
}
}

Explanation:
An event is declared by using the event keyword followed by a delegate type and then a name for the event.
B fax is not a delegate type.
C&D do not declare events.

One Comment on “Which code segment should you use?


Leave a Reply