What is info
in new info
? Is it some class of yours? If yes, does it inherit from the SampleDataGroup
type you typed your list with? If yes and you are assigning values to it using a constructor, then use
data.PhotoUrl = string.Format("Assets/Images/{0}.jpg", data.Name)
Doing this with if/else
as mentioned in comments would be a suicide. IF not now, then surely when you decide to expand.