Patcher.Data.Plugins.Content.MemberInfo.EnsureListCreated C# (CSharp) Method

EnsureListCreated() public method

public EnsureListCreated ( object target ) : void
target object
return void
        public void EnsureListCreated(object target)
        {
            if (!IsListType)
                throw new InvalidOperationException("Cannot create list for field that is not a list");

            object list = property.GetValue(target, null);
            if (list == null)
            {
                list = createListCtor.Invoke(paramlessArgs);
                property.SetValue(target, list, null);
            }
        }