MTA Software Development Fundamentals Help RRS feed

  • Question

  • Hey all, I've been reading through lesson 2 of "Exam 98-361 MTA Software Development Fundamentals" and there's a question at the end of the lesson which reads as follows.

    Imagine that you are writing code for creating and handling events in your program. The
    class SampleClass needs to implement the following interface:

    public delegate void SampleDelegate();
    public interface ISampleEvents
        event SampleDelegate SampleEvent;
        void Invoke();

    You need to write code for the SampleClass and for a test method that creates an instance of
    the SampleClass and invokes the event. What code should you write?

    I cannot wrap my head around what the question requires me to do, even after numerous rereads of the lesson. Any help would be greatly appreciated!

    Thanks Seb

    • Edited by sebheron21 Monday, October 2, 2017 11:48 AM mistitled
    Monday, October 2, 2017 11:48 AM


All replies

  • Hi,

    You could look into following thread answer. As it asked the same question. Hope this helps you.

    using a delegate to handle events within an interface, C#

    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered"Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Monday, October 2, 2017 12:24 PM
  • Hi sebheron , 

    You're going to need to write a unit test for that class 

    I recommond reading this walktrough.

    Kind regards


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, October 2, 2017 12:28 PM
  • "You need to write code for the SampleClass"

    You need to create a class that implements that interface. What is unspecified in the instructions is that the Invoke method needs to raise the SampleEvent event when called.

    "and for a test method that creates an instance of the SampleClass and invokes the event"

    You need to create a test method (outside the class) that creates an instance of your new type and then raises the event. To verify the event was raised you'll probably need to hook up a method to the event. 

    Michael Taylor

    Monday, October 2, 2017 1:49 PM