Array elements cannot be of static type
CodeRush Classic shows the Array elements cannot be of static type code issue if you are trying to create an array of static type elements.
#Fix
Make the type non-static.
#Purpose
Highlights the array declarations, which would cause the array elements cannot be of static type compilation error.
#Example
static class Class1
{
public static object data { get; set; }
}
class MyClass
{
private void TestMethod()
{
Class1[] myArray = new │Class1[5];
}
}
Fix:
class Class1
{
public static object data { get; set; }
}
class MyClass
{
private void TestMethod()
{
Class1[] myArray = new Class1[5];
}
}