Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

How do I call a string inside a different class

public static List<CardData> cardDataList = new List<CardData>();

public class CardData
{
  public string cardType { get; set; }
  public int cardColor { get; set; }
}

static void Main(string[] args){
 Console.WriteLine(this.cardDataList.FirstOrDefault().CardType);
}

// another function should be called before the printing
public void MyAddFunction()
{
  cardDataList.Add(new CardData() { cardType = boxLine1, cardColor = randColor });
}
 
PREVIOUS NEXT
Tagged: #How #I #call #string #class
ADD COMMENT
Topic
Name
1+1 =