```
public class Solution
{
public int MaxPoints(Point[] points)
{
var globalMax = 0;
for (int i = 0; i < points.Length; i++)
{
var kAndCount = new Dictionary<double, int>();
var samePointCount = 0;
var kEqualsZeroCount = 0;
for (int j = 0; j < points.Length; j++)
{
var pointX = points[i];
var pointY = points[j];
if (pointX.x == pointY.x && pointX.y == pointY.y)
{
samePointCount++;
}
else if (pointX.y == pointY.y)
{
kEqualsZeroCount++;
}
else
{
var k = (double)(pointX.x - pointY.x)/(pointX.y - pointY.y);
if (!kAndCount.ContainsKey(k)) kAndCount[k] = 0;
kAndCount[k]++;
}
}
var localMax = 0;
if (kAndCount.Values.Count == 0) localMax = kEqualsZeroCount + samePointCount;
else localMax = Math.Max(kAndCount.Values.Max(), kEqualsZeroCount) + samePointCount;
globalMax = Math.Max(globalMax, localMax);
}
return globalMax;
}
}
```