Question: What am I doing wrong in my C# code? This is my code: namespace tester { //Define the class for creating the application. //class definition

What am I doing wrong in my C# code?

This is my code:

namespace tester { //Define the class for creating the application. //class definition class TestIsEqualTo { //Define the generic method that would be used to compare two typed values. The values would //be passed as arguments. /* Generic method to compare two values * @param firstArg is the first argument * @param secondArg is the second argument * @return true if both of the values are equal, false * otherwise */ private static bool IsEqualTo(T firstArg, S secondArg) { //Invoke the method Equals() to compare the objects. Return true, if both are equal; false //otherwise. //invoke the Equals method if (firstArg.Equals(secondArg)) return true; else return false; } //Define the Main() method. // Main() defined static void Main(string[] args) { //Invoke the method with different typed argument. The result would explain that for the values //which have the same basic type, the method would return true. //call IsEqualsTo method with //different argument Console.WriteLine("compare two type obj 10 and int 10 \t" + IsEqualTo((object)10, 10)); //compare float and int Console.WriteLine("compare two type float 10 and int 10\t" + IsEqualTo((float)10.0F, 10)); //compare int and int Console.WriteLine("compare two type int 11 and int 10 \t" + IsEqualTo(11, 10)); //compare string and int Console.WriteLine("compare two type string 10 and int 10 \t" + IsEqualTo("10", 10)); //compare double and int Console.WriteLine("compare two type double 10 and int 10 \t" + IsEqualTo(((double)10), 10)); Console.ReadKey(); } } }

These are my errors:

The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)

The type or namespace name 'S' could not be found (are you missing a using directive or an assembly reference?)

This is C#!

Any help is greatly appreciated!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!