mickey donny
New member
- Joined
- Oct 3, 2018
- Messages
- 3
- Programming Experience
- 1-3
Hello guys,
I have a project to do for school in C# and this is part of my code. The code works fine, but if you guys could give me tips on how it should improved, that would be awesome. I have a hard time understanding why new Cours(search) works to find a certain object with the same name. The Cours class constructor takes a string parameter for the name attribute and implements the IComparable interface.
Here is some code :
Thank you
- Mickey
I have a project to do for school in C# and this is part of my code. The code works fine, but if you guys could give me tips on how it should improved, that would be awesome. I have a hard time understanding why new Cours(search) works to find a certain object with the same name. The Cours class constructor takes a string parameter for the name attribute and implements the IComparable interface.
Here is some code :
C#:
private List<Cours> cours;
...
public Cours Search(string search){
cours.Sort();
int index = Array.BinarySearch(cours.ToArray(), new Cours(search));
return cours[index];
}
Thank you
- Mickey