大家好 今天對於型態上有一些問題想詢問
這是我其中一個class
    public class CLD243_Content
    {
        [Slapper.AutoMapper.Id]
        public string INQIDN { get;set; }
        [Slapper.AutoMapper.Id]
        public string INQNAM { get;set; } 
        public List<GUR_Data> GUR { get; set; }
    }
這是我另外一個class
    public class test_info
    {
        public string subtotal_1 { get; set; }
        public string subtotal_2 { get; set; }  
        public List<CLD243_Content> content { get; set; }
    }
當我下SQL資料會塞入List<CLD243_Content>,接著我要對資料進行一些處理和運算
所以我又下了foreach 要將資料進行分類。
我要將List<CLD243_Content>的第0筆資料塞入test_info底下的content於是我宣告test_info一個是List一個是暫時存取資料,並且進行foreach塞入剛剛SQL回傳回來的List<CLD243_Content>。
//最後整理完畢的結果
List<test_info> testList = new List<test_info>();
//暫時存取資料
test_info test_Info = new test_info();  
//處理邏輯
foreach(var items in CLD243_content)
{
    test_Info.content.Add(items);
    test_Info.content[0] = items;
}

這兩種塞入值我都得到並未將物件參考設定為物件的執行個體。
我想請問各位我是不是哪裡理解錯誤了
還請各位指教 抱歉
建構式要先初始化
public class test_info
{
    public string subtotal_1 { get; set; }
    public string subtotal_2 { get; set; }  
    public List<CLD243_Content> content { get; set; }
    
    public test_info()
    {
        test_Info.content = new List<CLD243_Content>();
    }
}