First off, I just wanna take a second to assure all readers here that I'm not 'proficient' in C#, and thus an answer may be obvious (though I couldn't find one when searching).
I currently have a EnumerableUtility
custom class to convert data types (usually Enumerables, though sometimes other data types) into an object[]
array. I'm using a very sloppy method which essentially goes like this:
class EnumerableUtility
{
private IReadOnlyCollection<object> data;
public EnumerableUtility(IReadOnlyCollection<object> x)
{
data = x;
}
public object[] ConvertToArray()
{
object[] info = { };
// Here's where I think the exception is raised
foreach (object obj in data)
info[info.Length] = obj;
return info;
}
}
Again, sorry for both horrible code, sloppy methods and slight ignorance, but I kinda want to sort this out into a proper 'array' for easier management. Is there any way to do this? Thanks.