I want to store each item to a json array which is placed inside a foreach loop.
object array="";
foreach (DataRow drow1 in alltheatre.Rows)
{
string theatname = drow1["TheatreName"].ToString();
string latitude = drow1["Latitude"].ToString();
string longitude = drow1["Longitude"].ToString();
string theatname = drow1["TheatreName"].ToString();
string theatid = drow1["TheatreDetailsId"].ToString();
string theataddre = drow1["TheatreAddress"].ToString();
string cntctnu = drow1["ContactNum"].ToString();
string theatimg = drow1["TheatreImage"].ToString();
string descr = drow1["TheatreDesc"].ToString();
string mouvieid = drow1["MovieMasterId"].ToString();
if (mouvieid <100)
{
array = new[]
{
new
{
Name = theatname,
Theatrdetailsid=theatid,
image=theatimg,
lat=latitude,
longi=longitude,
adress=theataddre,
contactnum=cntctnu,
desc=descr,
}
},
}
}
Here.i have a foreach loop for getting details about a theatre,i want to store these datas to a json array,based on the condition.Right now i can only managed to store 1 data,ie the last one.