This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
The CompareTo method in one of my classes involves assessing the distance between two points and returning a 1 positive one if the point compared is greater, 0 if equal and -1 if less.
int IComparable<Point>.CompareTo(Point other)
{
int resultX = X - other.X;
int resultY = Y - other.Y;
int result = resultX*resultX resultY*resultY;
if (result < 0)
{
return -1;
}
else if (result > 0)
{
return 1;
}
else
{
return 0;
}
}
However, when I try to use this method in one of my other classes, I get the following error "CS7036 There is no argument given that corresponds to the required formal parameter 'comparisonType' of 'MemoryExtensions.CompareTo(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison)'.
Does anyone know why this happens?
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learncsharp...