Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Console Application Question 1 Create a generic class, madabClass, with one type parameter . The class will have 2 fields (for now they can

C# Console Application

image text in transcribed

Question 1 Create a generic class, madabClass, with one type parameter . The class will have 2 fields (for now they can be public... I will allow it) o One is an integer for an index o The second is an array of the type passed in through the type parameter A constructor for the class will take in one parameter of int o This will initialize the backing field array to be of the size sent in o The index will be set to 0 . A function called DiselaWalue o will print out the current index and the current value of the array being pointed at by the index e.g. index 0 . o wil advance the index by one o if the index is out of range, loop it back to the beginning . Show it working o In the main of the program, instantiate your class o Add some values to your array o Run Displa Walue numerous times Question 2 Add to your madLabClass a generic method called talkToMe . Will have a type parameter list of 2 types . Will have 3 method parameters, using a mix of the 2 types (mix it up) o E.g. 2 method parameters of type1 and 1 of type2, or. . Will print out the value of the 3 objects and the types of the variables o Remember to use the toString function (we don't know if they can be printed out unless we explicitly make them strings) The GetType function will return the datatype of the variable o Will be a static method Will not return anything . Invoke and execute a few different variations Example output could be var1 (System.String>Hello var2 (System.Int32> 1 var3 System.String) . bob Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions