0

I have a class definition like so:

[XmlRoot("Developments")]
public class DevelopmentsClass : List<Development> { }

and in my controller I have this function:

public DevelopmentsClass getFeed()
{

  DevelopmentsClass returnDevelopments = new DevelopmentsClass();
  List<Development> developments = new List<Development>();

  Development development = new Development();

  //A bunch of code assigning variables to development and then adding development to developments
  return returnDevelopments;

}

My question is, how do I assign developments to DevelopmentsClass? I had to make this change to have XmlRoot and I don't want to rewrite a bunch of code....Is there a quick way to assign developments to DevelopmentsClass?

2
  • I am banging my head against the wall trying to figure this out Commented Feb 23, 2018 at 21:26
  • There has to be away to assign developments to DevelopmentsClass Commented Feb 23, 2018 at 21:26

1 Answer 1

1

This should work:

returnDevelopments.AddRange(developments);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.