Problem with List and Array?

I changed my code a bit… (2nd edited)

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Stats : MonoBehaviour {
	
	public static Stats Instance;
	
	public List<ItemList> Inventory;
    public string[] ItemNames;
    public int[] ItemCounts;
 
    void Awake () {
    Instance = this;
 	
	Inventory = new List<ItemList>[ItemNames.Length];
			
       for(int i = 0; i < ItemNames.Length + 1;i++)
       {
         Inventory_.Name = ItemNames*;*_

Inventory_.Count = ItemCounts*;
}
}*

This is what my ItemList looks like !
using UnityEngine;
using System.Collections;_

public struct ItemList

{
* public string ItemName;*
* public int ItemCount;*
}
The error is
Stats.cs(16,9): error CS0029: Cannot implicitly convert type System.Collections.Generic.List<ItemList>[]' to System.Collections.Generic.List'

Stats.cs(20,23): error CS1061: Type ItemList' does not contain a definition for Name’ and no extension method Name' of type ItemList’ could be found (are you missing a using directive or an assembly reference?)

Stats.cs(21,23): error CS1061: Type ItemList' does not contain a definition for Count’ and no extension method Count' of type ItemList’ could be found (are you missing a using directive or an assembly reference?)

How Can I use List with Array?
Same type?
string = string
int = int
Any Ideas??
I try to do a little Inventory with stackable items :frowning:

Try :

Inventory = new List<ItemList>(ItemNames.Length);
 
for(int i = 0; i < ItemNames.Length + 1;i++)
    {
        Inventory_.ItemName = ItemNames*;*_

Inventory_.ItemCount = ItemCounts*;
}
}*_

You can’t directly access the mehods of a list entry when using a struct type…
create a temp variable and add that one to your list.

    ...
    Inventory = new List<ItemList>();
    tempItemList = ItemList();
    for(int i = 0; i < ItemNames.Length;i++)
    {
        tempItemList.ItemName = ItemNames*;*

tempItemList.ItemCount = ItemCounts*;*
Inventory.Add(tempItemList);
}
}