Error CS0841: A local Variable 'cnt' cannot be used before it is declared

private void SetupPrimaryAttributes() {
for (int cnt= 0; cnt < _primaryAttribute.Length; cnt++)
_primaryAttribute[cnt] = new Attribute();
_primaryAttribute[cnt].Name = ((AttributeName)cnt).ToString();

}

//IF YOU NEED THE FULL CODE, PLEASE ASK

Enclose your for loop code with { }

for (condition) {
//do stuff
}

To expand on that, without the {} the only line that’s applicable to the condition/loop is the one immediately following it. Others line are not in it’s local scope. If you want to do multiple things you have to enclose those in squigglies. Since you don’t have those, that second line containing a reference to ‘cnt’ is invalid since ‘cnt’ is only in scope for the condition/for loop line