A developer examines a workflow in which filenames are stored within a collection. The collection is initialized with a single filename. When adding a new filename to the collection, which collection variable type will cause an error?
The collection variable type that will cause an error when adding a new filename to the collection is System.Array. This is because System.Array is a fixed-size collection that cannot be resized or modified once it is initialized. Therefore, if the collection is initialized with a single filename, it cannot accommodate any more filenames. To add a new filename to the collection, the developer should use a dynamic collection type, such as System.Collections.Generic.List or System.Data.DataTable, that can grow or shrink as needed. Alternatively, the developer can use System.Collections.Generic.Dictionary if the filenames need to be associated with some keys or values. References: [Array Class], [Collection Classes]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit