Fixed lists not deserialising correctly

This commit is contained in:
Kah Wei 2022-11-13 04:57:10 +08:00
parent cf60210b4a
commit 26e0e72b25
1 changed files with 5 additions and 2 deletions

View File

@ -212,8 +212,10 @@ namespace SHADE
System::Type^ listType = System::Collections::Generic::List<int>::typeid->GetGenericTypeDefinition()->MakeGenericType(typeList); System::Type^ listType = System::Collections::Generic::List<int>::typeid->GetGenericTypeDefinition()->MakeGenericType(typeList);
// Create a list of the specified type // Create a list of the specified type
array<int>^ params = gcnew array<int>{ node.size() }; array<int>^ params = gcnew array<int>{ node.size() };
object = System::Activator::CreateInstance(listType, params); System::Collections::IList^ list = safe_cast<System::Collections::IList^>
System::Collections::IList^ list = safe_cast<System::Collections::IList^>(object); (
System::Activator::CreateInstance(listType, params)
);
// Populate the list // Populate the list
for (int i = 0; i < LIST_SIZE; ++i) for (int i = 0; i < LIST_SIZE; ++i)
@ -227,6 +229,7 @@ namespace SHADE
list->Add(obj); list->Add(obj);
} }
} }
fieldInfo->SetValue(object, list);
} }
} }