问题
How do I tell what version of C# I'm using? I'm using a Mac with xCode. The reason I ask is because i have a book " C# 3.0" and it says that you can declare an multidimensional array like this.
int[,] num = new int[2,2];
When I try to do this I get a syntax error. Do I need to import another header other than foundation?
回答1:
Have you tried changing
new int[2.2]
to
new int[2,2]
?
回答2:
I think Walt's answer is right, but here's a good resource for determining which version of C# you're using with your .NET install (thanks to Jon Skeet's "C# In Depth" book!):
http://csharpindepth.com/Articles/Chapter1/Versions.aspx
回答3:
Are you sure that you are programming in C# and not Objective C? Importing foundation is something you would do in Objective C, not C#.
来源:https://stackoverflow.com/questions/1331715/what-version-of-c-sharp-am-i-using