What is the equivalent of Java's .length for arrays in C#?
Posted
by
Michael Loftus
on Stack Overflow
See other posts from Stack Overflow
or by Michael Loftus
Published on 2012-06-06T22:31:18Z
Indexed on
2012/06/06
22:40 UTC
Read the original article
Hit count: 146
I'm new to C#, and I'm trying to convert this code from java into C#.
static public double euclidean_2(double[] x, double[] y)
{
if (x.length != y.length) throw new RuntimeException("Arguments must have same number of dimensions.");
double cumssq = 0.0;
for (int i = 0; i < x.length; i++)
cumssq += (x[i] - y[i]) * (x[i] - y[i]);
return cumssq;
}
I know java uses .length but what is the equivalent in C# since I keep getting an error
Thanks
© Stack Overflow or respective owner