Roshan Gurung
  • Hello world
  • Programming
    • Clean Coding Principles
    • .NET
      • Get the keys with model state errors in MVC
      • Null Propagation Operator in C#
      • Add objects to a list without using loop
      • Convert an image (selected by path) to base64 string
      • Escape character for & in webconfig settings
    • Database
      • Update with join in mysql
Powered by GitBook
On this page

Was this helpful?

  1. Programming
  2. .NET

Add objects to a list without using loop

public class inputlist 
{
       public string name {get;set;}
       public int sortorder {get;set;}
}

List<inputlist > inputParam = new List<inputlist>
{
      new inputlist { name = "Apple", sortorder =1},
      new inputlist { name = "Google", sortorder =2},
      new inputlist { name = "Facebook", sortorder =3}  
};
PreviousNull Propagation Operator in C#NextConvert an image (selected by path) to base64 string

Last updated 4 years ago

Was this helpful?