📦 IrbyImaging.Utility – Carrier Enumeration Documentation

Welcome to the comprehensive documentation for the Carrier.cs file within the IrbyImaging.Utility namespace. This document will guide you through every aspect of the Carrier enum, its purpose, usage examples, dependencies, and even a UML diagram.


🗂 Table of Contents

  1. Overview & Purpose
  2. Key Functional Areas
  3. Dependencies & Technologies
  4. Data Models
  5. UML Diagram
  6. Sample Code Blocks & Usage Examples
  7. Third‑party Integrations
  8. Error Handling & Return Types
  9. Conclusion

1. Overview & Purpose

File: IrbyImaging.Utility/Carrier.cs
Assembly: IrbyImaging.BLUtility
Author: kvamshi
Created: 03‑31‑2022

The Carrier enum provides a strongly-typed list of supported mobile carriers in the Irby Imaging solution. It is used to:

  • Standardize references to telecommunication providers.
  • Offer user-friendly display names via attributes.
  • Ensure compile-time safety when selecting or validating carriers.

2. Key Functional Areas

  • Enumeration of Carriers
    Defines a finite list of carriers (None, ATT, Verizon).

  • Display Metadata
    Uses the [Display(Name = "...")] attribute for UI-friendly names.

  • Extensibility Point
    Enums can be extended with additional carriers or attributes.


3. Dependencies & Technologies

Dependency Purpose
System.ComponentModel.DataAnnotations Provides [Display] attribute for enums

Platform:

  • .NET Framework / .NET Core compatible.
  • No external NuGet packages beyond System.ComponentModel.Annotations.

4. Data Models

4.1 Carrier Enum Detailed

namespace IrbyImaging.Utility
{
    /// <summary>
    /// Enum Carrier
    /// </summary>
    public enum Carrier
    {
        /// <summary>
        /// The none
        /// </summary>
        None,

        /// <summary>
        /// The AT&T
        /// </summary>
        [Display(Name = "AT&T")]
        ATT,

        /// <summary>
        /// The Verizon
        /// </summary>
        Verizon
    }
}
Enum Member Underlying Value Display Name
None 0 “None”
ATT 1 “AT&T”
Verizon 2 “Verizon”
  • None
    • Default value when no carrier is selected.
  • ATT
    • Represents AT&T; decorated with a display name for UI.
  • Verizon
    • Represents Verizon; uses the enum name as display.

5. UML Diagram

Below is a PlantUML diagram for the Carrier enum:

@startuml
enum Carrier {
  + None
  + ATT : [Display(Name="AT&T")]
  + Verizon
}
@enduml

Carrier UML


6. Sample Code Blocks & Usage Examples

6.1 Retrieving the Display Name

Use reflection + DisplayAttribute to get the friendly name:

using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;

public static class EnumExtensions
{
    public static string GetDisplayName(this Enum enumValue)
    {
        return enumValue
            .GetType()
            .GetMember(enumValue.ToString())
            .First()
            .GetCustomAttribute<DisplayAttribute>()?
            .Name
            ?? enumValue.ToString();
    }
}

// Usage
Carrier carrier = Carrier.ATT;
Console.WriteLine(carrier.GetDisplayName()); // Outputs: AT&T

6.2 Parsing from String

Convert user input to Carrier enum safely:

if (Enum.TryParse<Carrier>("Verizon", ignoreCase: true, out var parsedCarrier))
{
    // parsedCarrier == Carrier.Verizon
}
else
{
    // Handle invalid input
}

6.3 Switch‑Case Logic

Illustrating business logic based on the selected carrier:

switch (carrier)
{
    case Carrier.ATT:
        // AT&T-specific logic
        break;
    case Carrier.Verizon:
        // Verizon-specific logic
        break;
    default:
        // None or unrecognized
        break;
}

7. Third‑party Integrations

Currently, Carrier.cs has no direct third-party integrations. It relies solely on the .NET DataAnnotations library for display metadata.


8. Error Handling & Return Types

  • Enum Parsing:
    • Use Enum.TryParse<> to avoid exceptions on invalid strings.
  • Display Name Retrieval:
    • Returns the enum name if no [Display] attribute is present.

No custom exceptions are defined in this file.


9. Conclusion

The Carrier enum is a simple yet essential part of the Irby Imaging utility library, providing:

  • Type safety for telecom carriers.
  • User-friendly display names.
  • Easy extensibility for adding future carriers.

Whether you’re rendering carrier names in a UI or writing conditional logic, this enum standardizes and simplifies your code. 🚀


Happy coding! 🎉