DiMiaN
DiMiaN
CC#
Created by DiMiaN on 3/14/2023 in #help
✅ How to add variable instead of value in JSON dynamic array?
Console.WriteLine(dynamicData.toon_guid_by_gateway[Convert.ToString(gateway)][player];
3 replies
CC#
Created by DiMiaN on 3/14/2023 in #help
✅ How to add variable instead of value in JSON dynamic array?
oh nevermind, solved it
3 replies
CC#
Created by DiMiaN on 3/12/2023 in #help
✅ How to add data to a list that is outside of Main()?
I will close this if there is nothing more to add
19 replies
CC#
Created by DiMiaN on 3/12/2023 in #help
✅ How to add data to a list that is outside of Main()?
alright, thanks alot man
19 replies
CC#
Created by DiMiaN on 3/12/2023 in #help
✅ How to add data to a list that is outside of Main()?
yeah Im a beginner. Ive worked a little bit with python and php before
19 replies
CC#
Created by DiMiaN on 3/12/2023 in #help
✅ How to add data to a list that is outside of Main()?
using System.Collections.Generic;
internal class Program
{
private static List<Animals> animalList = new List<Animals>();
public class Animals
{
public string Name { get; set; }
public int Amount { get; set; }

public Animals(string Name, int Amount)
{
this.Name = Name;
this.Amount = Amount;
}
}
public static void insertData(string animal, int amount)
{
animalList.Add(new Animals(animal, amount));
}
private static void Main(string[] args)
{
insertData("Dog", 4);
insertData("Cat", 12);

foreach (Animals animals in animalList)
{
Console.WriteLine(animals.Name);
}
}
}
using System.Collections.Generic;
internal class Program
{
private static List<Animals> animalList = new List<Animals>();
public class Animals
{
public string Name { get; set; }
public int Amount { get; set; }

public Animals(string Name, int Amount)
{
this.Name = Name;
this.Amount = Amount;
}
}
public static void insertData(string animal, int amount)
{
animalList.Add(new Animals(animal, amount));
}
private static void Main(string[] args)
{
insertData("Dog", 4);
insertData("Cat", 12);

foreach (Animals animals in animalList)
{
Console.WriteLine(animals.Name);
}
}
}
Am I even doing something right here or?
19 replies
CC#
Created by DiMiaN on 3/12/2023 in #help
✅ How to add data to a list that is outside of Main()?
thanks, appreciated. now I follow 🙂
19 replies
CC#
Created by DiMiaN on 3/12/2023 in #help
✅ How to add data to a list that is outside of Main()?
geez I dont even know what the word instantiate means. I dont even know where to begin
19 replies
CC#
Created by DiMiaN on 3/11/2023 in #help
✅ Outputting values from a list
/close
15 replies
CC#
Created by DiMiaN on 3/11/2023 in #help
✅ Outputting values from a list
thanks!
15 replies
CC#
Created by DiMiaN on 3/11/2023 in #help
✅ Outputting values from a list
oh okay? I was following a simple tutorial and this is one of the examples
15 replies