You write the following method (line numbers are included for reference only):
You need to ensure that the method extracts a list of URLs that match the following pattern:
@http://(www\.)?([^\.]+)\.com;
Which code should you insert at line 07?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Explanation:
* MatchCollection
Represents the set of successful matches found by iteratively applying a regular expression
pattern to the input string.
The collection is immutable (read-only) and has no public constructor. The Regex.Matches
method returns a MatchCollection object.
* List<T>.Add Method
Adds an object to the end of the List<T>.
Incorrect:
Not A: ICollection.SyncRoot PropertyFor collections whose underlying store is not publicly available, the expected implementation
is to return the current instance. Note that the pointer to the current instance might not be
sufficient for collections that wrap other collections; those should return the underlying
collection’s SyncRoot property.
Answer: D
reason, Regex.Matches creates a collection MatchCollection, so you simply iterate it.
correct
162 is the same