Answers for "c# add object to array"

C#
8

c# add to array

var Freds = new [] { "Fred", "Freddy" };
Freds = Freds.Concat(new [] { "Frederick" }).ToArray();
Posted by: Guest on May-01-2020
0

c# add object to array

Array.Resize(ref objArray, objArray.Length + 1);
objArray[objArray.Length - 1] = new Someobject();
Posted by: Guest on May-17-2020
0

add items to a class array

class Student
{
    IList<Subject> subjects = new List<Subject>();
}

class Subject
{
    string Name;
    string referenceBook;
}

//Now you can say:

someStudent.subjects.Add(new Subject());
Posted by: Guest on April-02-2020

C# Answers by Framework

Browse Popular Code Answers by Language