# Automatic Humanized Output

## Overview

The Automatic Humanized Output feature provides pre-formatted representations of a numeric value using the **Humanized** and **HumanizedValue** properties. These properties automatically apply a scaling system with suffixes such as **K (thousands), M (millions), B (billions), T (trillions), Q (quadrillions),** and **Qa (quintillions)** based on the magnitude of the number.

This feature is useful for applications where displaying large numbers in a condensed format improves readability and user experience.

***

### Key Points

<table><thead><tr><th width="197">Aspect</th><th>Details</th></tr></thead><tbody><tr><td>Properties Available</td><td><strong>Humanized</strong>, <strong>HumanizedValue</strong></td></tr><tr><td>Return Type</td><td><code>string</code></td></tr><tr><td>Purpose</td><td>Provides a human-readable version of the <code>Value</code> property with automatic suffix application.</td></tr><tr><td>Read-Only</td><td>Yes (automatically computed based on <code>Value</code>).</td></tr><tr><td>Default Behavior</td><td>Converts numbers ≥1000 using suffixes, keeping 2 decimal places by default.</td></tr><tr><td>Suffixes Used</td><td>"", "K" (thousands), "M" (millions), "B" (billions), "T" (trillions), "Q" (quadrillions), "Qa" (quintillions)</td></tr></tbody></table>

***

### Best Practices

<table><thead><tr><th width="240">Aspect</th><th>Recommendation</th></tr></thead><tbody><tr><td>Use Read-Only Properties</td><td>Directly access <code>Humanized</code> or <code>HumanizedValue</code> instead of manually formatting numbers.</td></tr><tr><td>Keep Decimal Precision</td><td>Use <code>GetHumanizedValue</code> when needing custom decimal precision.</td></tr><tr><td>Use in UI Components</td><td>Bind <code>Humanized</code> to UI elements like labels to automatically display formatted values.</td></tr><tr><td>Large Number Handling</td><td>Ensure extremely large numbers are appropriately capped or handled based on your application needs.</td></tr></tbody></table>

***

### Common Pitfalls

| Pitfall                       | Description                                                                     | Recommendation                                             |
| ----------------------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| Expecting Editable Output     | `Humanized` and `HumanizedValue` are read-only and cannot be manually set.      | Assign values to `Value` instead.                          |
| Using in Incorrect Contexts   | Directly displaying unformatted numbers can be difficult to read.               | Always retrieve the formatted output for display purposes. |
| Overlooking Decimal Precision | Default precision is 2 decimal places, which may not be suitable for all cases. | Use `GetHumanizedValue()` for finer control.               |

***

### Usage Scenarios

| Scenario                          | Description                                                                        | Example Code Sample                                                                                                                                                                        |
| --------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Displaying User-Friendly Numbers  | Automatically format large numbers for better readability in UI elements.          | `csharp<br>var humanizer = new SiticoneHumanizerDecimal();<br>humanizer.Value = 1500m;<br>Console.WriteLine(humanizer.Humanized); // Outputs: "1.50K"<br>`                                 |
| Data Dashboard Metrics            | Show summarized financial, analytic, or statistical data without excessive digits. | `csharp<br>var humanizer = new SiticoneHumanizerDecimal();<br>humanizer.Value = 1234567m;<br>Console.WriteLine("Total Sales: " + humanizer.Humanized); // Outputs: "1.23M"<br>`            |
| Database Query Results Formatting | Convert numerical outputs from databases into readable formats in real-time.       | `csharp<br>var salesFigure = database.GetRevenue();<br>var humanizer = new SiticoneHumanizerDecimal { Value = salesFigure };<br>Console.WriteLine("Revenue: " + humanizer.Humanized);<br>` |

***

### Real Life Usage Scenarios

<table><thead><tr><th width="244">Scenario</th><th>Description</th><th>Example Code Sample</th></tr></thead><tbody><tr><td>Financial Transactions</td><td>Display bank balances, transaction amounts, or market values in a condensed form.</td><td><code>csharp&#x3C;br>var balance = new SiticoneHumanizerDecimal();&#x3C;br>balance.Value = 12500000m;&#x3C;br>Console.WriteLine("Balance: " + balance.Humanized); // Outputs: "12.50M"&#x3C;br></code></td></tr><tr><td>Social Media Engagement</td><td>Format user statistics like follower counts, likes, or views in a more readable manner.</td><td><code>csharp&#x3C;br>var views = new SiticoneHumanizerDecimal();&#x3C;br>views.Value = 10234567m;&#x3C;br>Console.WriteLine("Video Views: " + views.Humanized); // Outputs: "10.23M"&#x3C;br></code></td></tr><tr><td>System Resource Monitoring</td><td>Show memory usage, CPU load, or storage space in a user-friendly format.</td><td><code>csharp&#x3C;br>var memoryUsage = new SiticoneHumanizerDecimal();&#x3C;br>memoryUsage.Value = 8048576m;&#x3C;br>Console.WriteLine("Memory Usage: " + memoryUsage.Humanized); // Outputs: "8.05M"&#x3C;br></code></td></tr></tbody></table>

***

### Troubleshooting Tips

<table><thead><tr><th width="209">Issue</th><th>Possible Cause</th><th>Suggested Resolution</th></tr></thead><tbody><tr><td>Humanized value is incorrect</td><td><code>Value</code> may not be assigned or may not be updated properly.</td><td>Ensure <code>Value</code> is set correctly before retrieving <code>Humanized</code>.</td></tr><tr><td>Unexpected decimal precision</td><td>The default precision is 2 decimal places.</td><td>Use <code>GetHumanizedValue(decimalPlaces: X)</code> for custom precision.</td></tr><tr><td>Large numbers don’t display</td><td>Extremely high values might exceed the predefined suffix range.</td><td>Implement logic to cap or handle numbers beyond the supported range.</td></tr></tbody></table>

***

### Review

<table><thead><tr><th width="174">Review Aspect</th><th>Notes</th></tr></thead><tbody><tr><td>Functionality</td><td>Automatically formats large numbers into a user-friendly representation.</td></tr><tr><td>Readability</td><td>Provides clear and compact numerical output using standard suffixes (K, M, B, etc.).</td></tr><tr><td>Integration Ease</td><td>Simple access via <code>Humanized</code> or <code>HumanizedValue</code>, requiring no additional formatting.</td></tr><tr><td>Customization</td><td>Supports additional control over decimal places and culture settings via method calls.</td></tr></tbody></table>

***

### Summary

<table><thead><tr><th width="234">Aspect</th><th>Summary</th></tr></thead><tbody><tr><td>Purpose</td><td>Converts large numbers into human-readable formats automatically.</td></tr><tr><td>Key Benefit</td><td>Simplifies data display by reducing large numerical values to a more concise representation.</td></tr><tr><td>Ease of Use</td><td>Easily accessible via the <code>Humanized</code> and <code>HumanizedValue</code> properties.</td></tr><tr><td>Readability Improvement</td><td>Enhances data presentation, especially in UI applications and reports.</td></tr></tbody></table>

***

### Additional Code Examples

#### Example 1: Basic Implementation in a Console Application

```csharp
using System;
using SiticoneNetFrameworkUI;

class Program
{
    static void Main()
    {
        SiticoneHumanizerDecimal humanizer = new SiticoneHumanizerDecimal();
        humanizer.Value = 2050000m;

        Console.WriteLine("Formatted Value: " + humanizer.Humanized);
        // Output: "2.05M"
    }
}
```

#### Example 2: Updating Values Dynamically in a WinForms UI

```csharp
using System;
using System.Windows.Forms;
using SiticoneNetFrameworkUI;

namespace HumanizerDemo
{
    public partial class MainForm : Form
    {
        private SiticoneHumanizerDecimal humanizer;

        public MainForm()
        {
            InitializeComponent();
            humanizer = new SiticoneHumanizerDecimal();
            labelOutput.Text = "Formatted Value: " + humanizer.Humanized;
        }

        private void buttonConvert_Click(object sender, EventArgs e)
        {
            if (decimal.TryParse(textBoxInput.Text, out decimal inputValue))
            {
                humanizer.Value = inputValue;
                labelOutput.Text = "Formatted Value: " + humanizer.Humanized;
            }
            else
            {
                MessageBox.Show("Please enter a valid number.");
            }
        }
    }
}
```

***

By following the detailed documentation above, developers can effectively use the Automatic Humanized Output feature in various applications, making numerical data more digestible and user-friendly.
