類應該是處理這種結構的正確方法,在C#一個簡單的實現應該是這樣的:
using System.Collections.Generic;
namespace DataStructure
{
class Program
{
static void Main(string[] args)
{
// Creating Data Set
var AllDataSet = new List<DataStructure>();
AllDataSet.Add(
new DataStructure(new char[] { 'A', 'T', 'G' }, new string[] { "Fever", "Cough" }, 24)
);
AllDataSet.Add(
new DataStructure(new char[] { 'T', 'C', 'G' }, new string[] { "High Blood Pressure" }, 56)
);
AllDataSet.Add(
new DataStructure(new char[] { 'A', 'T', 'G' }, new string[] { "Diabetes", "High Blood Pressure" }, 79)
);
}
}
public class DataStructure
{
public char[] DNAChar;
public string[] SetValuedData;
public int Age;
public DataStructure(char[] dnaChar, string[] setValuedData, int age)
{
DNAChar = dnaChar;
SetValuedData = setValuedData;
Age = age;
}
// Add other logic here
}
}
然後你就可以添加相應的功能來實現你的邏輯。希望,這會有所幫助!