Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAmy Tomey
12,847 Pointspoint.cs(5,16): error CS1644:
I get the following error when i try to compile in the treehouse terminal. I don't understand... it looks just like the instructors...
point.cs(5,16): error CS1644: Feature `primary constructor' cannot be used because it is not part of the C# 7.0 language specification
here is my point.cs file:
using System;
namespace TreehouseDefense
{
class Point()
{
public readonly int x;
public readonly int y;
public Point(int x, int y)
{
X = x;
Y = y;
}
public int DistanceTo(int x, int y)
{
int xDiff = X - x;
int yDiff = Y - y;
int xDiffSquared = xDiff * xDiff;
int yDiffSquared = yDiff * yDiff;
Math.Sqrt(xDiffSquared + yDiffSquared);
}
}
}
1 Answer
Steven Parker
231,269 PointsIf you look at the example in the video, you'll notice there is nothing between the class name and the brace that begins the body of the definition.
But the code above has a pair of parentheses after the class name.