Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Cannot implicitly convert type void to List

C Sharper:

I have below Class structure :-


class Child
{
public List ParentData { get; set; }
}
class ParentData
{
public string FatherName {get;set;}
public string MotherName {get;set;}
public List GrandParentData{ get; set; }
}
class GrandParentData
{
public string GrandFatherName {get;set;}
public string GrandMotherName {get;set;}
}

When I am trying to Fill this :-


foreach (var item in res)
{
obj.StoryData.Add(
new StoryData
{
FatherName = item.FatherName,
MotherName = item.Description,
GrandParentData=new Listnew GrandParentData { GrandFatherName = "",GrandMotherName =""}
);

}
);

}

This is giving me error when I am trying to add data to GrandParentList List as :- Cannot implicitly convert type void to List

Do I need to change my class structure ? or what edits I should made in my code?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Cannot implicitly convert type void to List

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×