Hergine Richemont

Learning just for the fun of it

tuples in c#

C# Track, Exercism #43 Phone Number Analysis

Relevant link


Github solution: exercism-solutions/phone-number-analysis

Exercism #43: Phone Number Analysis

Learning Goal

Tuples

Relevant Information

Tuples in C# is a way of organizing data to hold 2 or more fields of any type. Each field is separated by commas within parentheses.

Task 1

Your analysis should return 3 pieces of data

  1. An indication of whether the number has a New York dialing code ie. 212 as the first 3 digits
  2. An indication of whether the number is fake having 555 as a prefix code in positions 5 to 7 (numbering from 1)
  3. The last 4 digits of the number.

Implement the (static) method PhoneNumber.Analyze() to produce the phone number info.

Task 2: Detect if a phone number has a fake prefix code (555)


When do you choose a tuple over a custom type?

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted