How does a property that returns a byte[,] signature have the same parameter types as a function that returns a bool and has a passed byte[,] signature?
Here is the command:
...My Documents>csc /target:library /out:CourtneyNumbrs.dll CourtneyNumbrs.cs
here is the output:
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
CourtneyNumbrs.cs(25,17): error CS0082: Type 'CourtneyNumbers' already reserves a member called 'set_Numbers' with the
same parameter types
CourtneyNumbrs.cs(220,17): (Location of symbol related to previous error
Failed code on line 25:
public byte[,] Numbers {
get {
byte[,] sts = new byte[7,7];
int i;
int j;
for (i = 0;i <7;i++) {
for (j = 0;j <7;j++) {
sts[i, j] = 0;
}
}
for (i = 1;i <7;i += 2) {
for (j = 1;j <7;j += 2) {
sts[i, j] = Cnumbrs[i / 2, j / 2].Solve ;
}
}
return sts;
}
}
Reserved code on line 220:
public bool set_Numbers(byte[,] Numbrs) {
byte o;
bool ischanged = false;
for (int j = 0;j < 3;j++) {
for (int i = 0;i < 3;i++) {
o = Numbrs[i, j];
if (o > 14 && o < 50) this.Cnumbrs[i, j].Solve = o;
else {
ischanged = true;
Numbrs[i, j] = Cnumbrs[i, j].Solve;
}
}
}
return ischanged;
}
In one case the property is Numbers, in the other, the function is set_Numbers, the parameter name is Numbrs. The array signature is the only thing that is common and you should be able to use the same parameter signatures when the names are different.
Yes, I solve the problem by adding a ref bool to the function that would now return a void.
Forcing different parameter types when you are producing overloaded routines with the same name makes perfect sense. Doing so for unrelated routines is nuts. (OK, semi-unrelated.)