using System;
using System.IO;
using System.Text;
public class Movies
{
public string moviename { get; set; }
public int cast { get; set; }
public string[] castmember { get; set; }
public override string ToString()
{
return string.Format("Movie: {0} \nCast #: {1} \nCast Member: {3}",
moviename.ToString(),
cast,
castmember.ToString());
}
}
public class MovieData
{
public int NumberOfLines = 0;
public string UserInput;
public void ManageData()
{
string[] text = File.ReadAllLines("@File Path");
NumberOfLines = text.GetUpperBound(0);
Movies[] movies = new Movies[NumberOfLines];
int i = 0;
foreach (string line in text)
{
movies[i] = new Movies();
movies[i].moviename = Convert.ToString(line.Trim());
movies[i].cast = Convert.ToInt32(line.Trim());
int ii = movies[i].cast;
//Here I want to create a movies[i].castmember[ii] with ii being the length
}
基本的に行形式のデータを格納しようとしていますが、配列に格納する方が論理的である特定の行のセットがあります。長さがii(キャスト)のmovies [i] .castmember配列を作成するにはどうすればよいですか?