[SOLVED] Write a generic method that accepts ...

20.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product

Write a generic method that accepts three parameters of the same type and displays them in order. For numeric data, “in order” means in numerical order. For other classes, you can define “in order” appropriately. Test the method using at least four different data types, including at least one for which you implement a CompareTo() method.

Having hard time to solve this…

public class SortOrderDemo

{

public static T SortOrder<T> (T x, T y, T z) where T : IComparable<T>

//can’t think of a logic after this..

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.