About 711,000 results
Open links in new tab
  1. Quick way to create a list of values in C#? - Stack Overflow

    If you want to create a typed list with values, here's the syntax. Assuming a class of Student like. public class Student { public int StudentID { get; set; } public string StudentName { get; set; } }

  2. .net - Creating a List of Lists in C# - Stack Overflow

    Feb 25, 2015 · how to create list of lists in c#-1. C# split big html to H1 and text up to next H1. 0.

  3. c# - How to initialize a list of strings (List<string>) with many ...

    List<string> optionList = new List<string> {"AdditionalCardPersonAdressType"}; optionList.Add("AutomaticRaiseCreditLimit"); optionList.Add("CardDeliveryTimeWeekDay"); In …

  4. c# - Storing data into list with class - Stack Overflow

    Aug 28, 2015 · In fact, the only overload of List<T>.Add takes in a T. Therefore, you have to create an instance of EmailData and pass that to List<T>.Add. That is what the above code …

  5. c# - Create a Generic list of <T> - Stack Overflow

    Aug 12, 2020 · Sounds like you are trying to create a new list that contains some initial data, and you need to do this for many different types T. If Mtrl and Trdr has nothing in common and are …

  6. c# - A generic list of anonymous class - Stack Overflow

    Mar 20, 2017 · anonymous types are designed to be used as temporary storage, in most cases you would create them in LINQ select statement using Select(i=>new {i.ID,i.Name}); which …

  7. Define a List of Objects in C# - Stack Overflow

    I have a C# console app. My app has a class called Item. Item is defined like this: public class Item { public int Id { get; set; } public string Name { get; set; } public string Description { get; …

  8. Creating a list within a list C# - Stack Overflow

    Dec 11, 2011 · It depends, as already given as an awnser, you could use a List<List<int>>.Although, since we are using a OO language, and if the amount of lists of ints …

  9. c# - How to create a List with a dynamic object type - Stack Overflow

    Jun 6, 2017 · Basically in C#, the .Add method of a List of objects does not COPY new added objects into the list, it merely copies a reference to the object (it's address) into the List. So the …

  10. Shortcut for creating single item list in C# - Stack Overflow

    As the C# language evolves, we can now make this in an even simpler way utilizing "List-Patterns" that was introduced in C# 11. (C# 11 was released in November 2022). Using list …

Refresh