/* */

Dynamic Data for Test Purpose.

This one is basically for beginner how wanted to have some dynamic data over run time.

1)Create a class name it as Customer.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MyFirstHelloWorld.Models
{
    public class Customer
    {
        public int ID { get; set; }
        public string customerCode { get; set; }
        public double amount { get; set; }

        public Customer(int Id,string CustomerID,double Amount)
        {
            ID = Id;
            customerCode = CustomerID;
            amount = Amount;
        }
    }
}

2) Then inside the method where you want to bind dynamic data .They can use

 List<Customer> test = new List<Customer>();

            for (int i = 0; i < 50; i++)
            {
                test.Add(new Customer(i, Convert.ToString(i), Convert.ToDouble(i)));
            }


So test will have dynamic data over run time. 
Previous
Next Post »
Thanks for your comment