How to get single value of List<object>

后端 未结 2 333
悲哀的现实
悲哀的现实 2021-01-18 10:29

I\'m a new to ASPX, hope you dont mind if my problem is so simple with somebody.

I use a List selectedValues;

selectedValu         


        
      
      
      
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-18 11:00

    Define a class like this :

    public class myclass {
           string id ;
           string title ;
           string content;
     }
    
     public class program {
            public void Main () {
                   List objlist = new List () ;
                   foreach (var value in objlist)  {
                           TextBox1.Text = value.id ;
                           TextBox2.Text= value.title;
                           TextBox3.Text= value.content ;
                    }
             }
      }
    

    I tried to draw a sketch and you can improve it in many ways. Instead of defining class "myclass", you can define struct.

提交回复
热议问题