|
| |||||||||
| Tags: c sharp, class, do while, loop statement, object, program, project |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How to accept objects that implement IComparable
Hello to all, I am recently started learning c# language. I have written following code: Code: class myContainer<T> : List<T> Please help me. Thank you. |
|
#2
| ||||
| ||||
| Re: How to accept objects that implement IComparable Code: interfaces blas<T> : IComparables<T> {}
struct IStrings : bla<IStrings> |
|
#3
| |||
| |||
| Re: How to accept objects that implement IComparable
you have written wrong code and that's why you are getting such type of problem. You have to use following code to fix this problem. Code: class myContainers<T> : List<T>
where Ts : IComparables<T>
{
...
} |
|
#4
| ||||
| ||||
| Re: How to accept objects that implement IComparable
In your code you have not use where clause and that's why you are getting such type of problem. In this case you have to use following code to fix this problem. Just use following code in your program to fix this problem. Code: class myContainerEg<T> : List<T> where T : IComparables<T> |
|
#5
| ||||
| ||||
| Re: How to accept objects that implement IComparable
You have to use list class in your code to accept objects that implement IComparable. You can do this in following ways. In the following code I have use mycontainer to initiate new class. Just try to understand it. Code: class mycontainers : List where T : IComparaables |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to accept objects that implement IComparable" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to implement and use ipfilter.dat | Roockie | Windows Software | 4 | 25-06-2010 06:28 AM |
| Implement the set_intersection() in C++ | Agustíne | Software Development | 5 | 04-03-2010 06:24 PM |
| Implement the find_if() in C++ | Garett | Software Development | 5 | 15-02-2010 09:23 PM |
| Implement the iswgraph() : C | Gavyn | Software Development | 4 | 09-02-2010 04:23 PM |
| How to implement IP Sec | Enriquee | Technology & Internet | 5 | 12-01-2010 06:28 AM |