Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

3
What is wrong with my CompareTo method?
Post Body

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?

Author
Account Strength
30%
Account Age
2 years
Verified Email
No
Verified Flair
No
Total Karma
2,207
Link Karma
1,546
Comment Karma
661
Profile updated: 1 week ago
Posts updated: 11 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago