TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sanjay gautam
NA
90
14.4k
convert loop to linq
Oct 21 2019 11:25 PM
How to convert foreach loop in linq there is any esay way to change loop to linq i have some code showen blewo
static
public
string
table2Json(DataSet ds,
int
table_no)
{
try
{
object
[][] tb =
new
object
[ds.Tables[table_no].Rows.Count][];
int
r = 0;
foreach
(DataRow dr
in
ds.Tables[table_no].Rows)
{
tb[r] =
new
object
[ds.Tables[table_no].Columns.Count];
int
col = 0;
foreach
(DataColumn column
in
ds.Tables[table_no].Columns)
{
tb[r][col] = dr[col];
if
((tb[r][col]).Equals(System.DBNull.Value))
{
tb[r][col] =
""
;
}
col++;
}
r++;
}
string
table = JsonConvert.SerializeObject(tb, Formatting.Indented);
return
table;
}
catch
(Exception ex)
{
tools.log(ex.Message);
throw
ex;
}
}
Reply
Answers (
3
)
How to do Remember me functionality in Login in mvc
Gujarati sms in asp.net c#