Better yet, this is what I am trying to convert to C#:
var Contents : Transform[ ]; //The content of the Inventory
// Add an item to the inventory.
function AddItem(Item:Transform)
{
var newContents = new Array(Contents);
newContents.Add(Item);
Contents=newContents.ToBuiltin(Transform); //Array to unity builtin array
No, with a List there is no need to replace the field, you can simply say
List<Transform> Contents = new List<Transform>();
public void AddItem(Transform item){
Contents.Add(item);
// Update your inventory list here; I'd cache the Inventory_Display component in Awake instead of using GetComponent every time you need to use it
}
Your 2 code blocks are doing different things. The JS code gets an Item component from each Transform in UpdatedList. Your C# code gets a Pick_Ups component on the same GameObject as the script executing that code.