Error CS1729: Trying to make a generic list of strings.

Trying to make a generic list of strings but I can’t figure out or find any info on doing this without using int. I’m sure I’m overlooking some basic knowledge so please fill me in!

Assets/Scripts/Wordspawn.cs(10,105): error CS1729: The type System.Collections.Generic.List<string>' does not contain a constructor that takes 5’ arguments

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

public class Wordspawn : MonoBehaviour {

// Use this for initialization
void Start () {

List words = new List(“River”, “Mango”, “DBM2BABY”, “Seven”, “Brownies”);

Please use code tags: Using code tags properly - Unity Engine - Unity Discussions

Your syntax is incorrect, it should be

List<string> words = new List<string> { "River", "Mango", "DBM2BABY", "Seven", "Brownies" 
};
2 Likes

Thank you! I’m switching from JS to C# after not writing any scripts since college. So I’m basically starting from scratch. Appreciate you linking relevant documentation.

1 Like