Generics data type and interfaces

we were taught about Generics and Interfaces at uni and I wasn't sure what the perfect situations are to use interfaces because they don't have implementation in them so they work as a contract to other classes where everyone can implement their methods as long as they extend the interfaces.

As for generics, as far as I understand them, you make your own data structure or data type, right?

that would be greatly appreciated if someone can clarify those points.

â€œSuccess means having the courage, the determination, and the will to become the person you believe you were meant to beâ€
If my post helps you SOLVE your problem or ANSWER your question, please mark it as solved.
IF things go wrong then ROLLBACK baby :)

Generics are used when you can apply the same situation to multiple objects. They are very much like templates in C++.

Let's take the "List" class.

The definition is List<T> where T is a type of object. As we don't really care what the list contains, the list can contain anything :)

This is why you specify the type when you create the List. Example: List<Int32> will contain a list of Int32s. This means when you want to perform an operation on an object in the list, it is strongly typed and you have access to all the functionality that object allows you. It also means you can't do things like adding a Double to a list of ints.

Generics can be as complicated or simple as you want them to be, but they can be extremely useful and powerful, especially when combined with reflection.

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...