int age = 30;
int[] numbers = { 10, 20, 30, 40 };
for (int i = 0; i < numbers.Length; i++) { Console.WriteLine(numbers[i]); }
public class Person { public string Name { get; set; } public int Age { get; set; } }
Person person = new Person(); person.Name = "John"; person.Age = 30;
using Newtonsoft.Json; using System.Collections.Generic; // ... ListIn this example, we are using the Newtonsoft.Json NuGet package to convert a list of Person objects to JSON format and then deserialize the JSON back into a list of Person objects.people = new List { new Person { Name = "John", Age = 30 }, new Person { Name = "Jane", Age = 25 }, }; string json = JsonConvert.SerializeObject(people); List deserializedPeople = JsonConvert.DeserializeObject >(json);