Implicit conversion of an array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Given:
Class Data
{
Public Data (string[] vals) { /*Fills properties*/ }
}

public Data[] ParseFile (StreamReader input)
{
ArrayList list = new ArrayList();
string line = input.ReadLine();
while (line!=null)
{
list.Add (new Data (line.Split ('|')));
}

Is there a way to declare an implicit conversion such that

return list.ToArray();

Works?

}

TIA,
Dave
 
Dave said:
Given:
Class Data
{
Public Data (string[] vals) { /*Fills properties*/ }
}

public Data[] ParseFile (StreamReader input)
{
ArrayList list = new ArrayList();
string line = input.ReadLine();
while (line!=null)
{
list.Add (new Data (line.Split ('|')));
}

Is there a way to declare an implicit conversion such that

return list.ToArray();

Works?

Don't think so. Why not just cast?
 
Back
Top