Add an object to an anonymous set

Source: Internet
Author: User

On the Internet, some netizens asked if they were adding objects to an anonymous set. The examples provided by netizens are as follows:



In fact, when an anonymous set is added dynamically, another anonymous object p can be declared, and the original anonymous set is converted to ToList () and then assigned to the p anonymous object. Now we can add data to the p set. After adding the data, convert it to ToArray () and assign the value to the original object.




In the following example, Insus. NET uses the Generic type (Generic). The original set List <string> already has three objects.



Add two data set objects. First convert to ToList <string> (), then add two objects, and then convert to ToList <string>.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.