Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1. (13 marks) You should create a console project named Q1 to do the following implementation. In the program below MyClass is a delegate.

imageimage

Q1. (13 marks) You should create a console project named Q1 to do the following implementation. In the program below MyClass is a delegate. Define a method named callMe such that it is an extension method of the delegate MyClass when the following code fragments are run together with the method callMe, the integer 3 is dis- played as output on the console. You will receive 0 mark in this question if you change any code in the class MyWordCount and the class Program. using System; using System. Text; namespace Q1 { //(4 marks) //add necessary code below that declares the delegate MyClass // (9 marks) //add necessary code below that defines the method callMe public static class MyWordCount { } public static int numOfWords (StringBuilder sb) { } string[] words = sb. ToString().Split(' '); return words. Length; } public class Program { } public static void Main() { } MyClass k = MyWordCount.numOfWords; StringBuilder stb = new String Builder ("I am good"); Console.WriteLine( k.callMe (stb)); Console.ReadKey(); //Halts execution

Step by Step Solution

3.49 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

Heres the implementation of the callMe method as an extension method of the MyClass delegate csharp ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Reporting Financial Statement Analysis And Valuation A Strategic Perspective

Authors: James M. Wahlen, Stephen P. Baginski, Mark Bradshaw

9th Edition

1337614689, 1337614688, 9781337668262, 978-1337614689

More Books

Students also viewed these Programming questions

Question

Describe specific developments that advanced cognitive psychology.

Answered: 1 week ago

Question

List the 8 Es and explain how they impact organizational success.

Answered: 1 week ago