Which two code segments can you use to achieve this goal?

You are implementing a method named GetValidPhoneNumbers. The GetValidPhoneNumbers() methodprocesses a list of string values that represent phone numbers.
The GetValidPhoneNumbers() method must return only phone numbers that are in a valid format.
You need to implement the GetValidPhoneNumbers() method.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete
solution. Choose two.)

You are implementing a method named GetValidPhoneNumbers. The GetValidPhoneNumbers() methodprocesses a list of string values that represent phone numbers.
The GetValidPhoneNumbers() method must return only phone numbers that are in a valid format.
You need to implement the GetValidPhoneNumbers() method.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete
solution. Choose two.)

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
* Regex.Matches
Searches an input string for all occurrences of a regular expression and returns all the matches.
* 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>.



Leave a Reply 0

Your email address will not be published. Required fields are marked *