.NET 도움말 Humanizer C# (How It Works For Developers) 커티스 차우 업데이트됨:6월 22, 2025 다운로드 IronPDF NuGet 다운로드 DLL 다운로드 윈도우 설치 프로그램 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 Humanizer is a powerful and flexible .NET library that simplifies and humanizes the process of working with data, especially when it comes to displaying information in a user-friendly format. Whether you need to convert dates to relative time strings ("3 days ago"), pluralize words, format numbers as words, or work with enums, displaying strings, Pascal case input strings as sentences with custom descriptions, underscored input strings to normal title case strings, and long text truncation, Humanizer provides a plethora of tools and extension methods to handle these tasks elegantly in C#.NET to convert dehumanized input strings into sentences. In this article, we will discuss a detailed tutorial of Humanizer in C#. We will also discuss how to generate PDF documents using Humanizer and IronPDF for the C# PDF Library. Setting Up Humanizer in C# To get started with Humanizer, you need to install the library via NuGet. In your project, you can do this through the Package Manager Console with the following command: Install-Package Humanizer Alternatively, if you are using the .NET Core CLI, you can add Humanizer with: dotnet add package Humanizer After installation, you can start using Humanizer by including the appropriate namespace in your C# files: using Humanizer; using Humanizer; $vbLabelText $csharpLabel Humanizing Dates and Times One of the most common uses of Humanizer is to convert dates and times into human-readable formats, timespans, numbers, and quantities using the Humanize method. This is particularly useful for displaying relative times, such as "2 hours ago" or "in 5 days". Example: Humanizing Relative Time using System; class HumanizerDemo { static void Main() { DateTime pastDate = DateTime.Now.AddDays(-3); // Humanize the past date, which converts it to a relative time format string humanizedTime = pastDate.Humanize(); // Output: "3 days ago" DateTime futureDate = DateTime.Now.AddHours(5); // Humanize the future date, presenting it in relative time string futureHumanizedTime = futureDate.Humanize(); // Output: "in 5 hours" Console.WriteLine("Humanized Past Date: " + humanizedTime); Console.WriteLine("Humanized Future Date: " + futureHumanizedTime); } } using System; class HumanizerDemo { static void Main() { DateTime pastDate = DateTime.Now.AddDays(-3); // Humanize the past date, which converts it to a relative time format string humanizedTime = pastDate.Humanize(); // Output: "3 days ago" DateTime futureDate = DateTime.Now.AddHours(5); // Humanize the future date, presenting it in relative time string futureHumanizedTime = futureDate.Humanize(); // Output: "in 5 hours" Console.WriteLine("Humanized Past Date: " + humanizedTime); Console.WriteLine("Humanized Future Date: " + futureHumanizedTime); } } $vbLabelText $csharpLabel The Humanizer extension method automatically handles different time units and even adjusts for grammatical correctness. Humanizing TimeSpans Humanizer can also humanize TimeSpan objects, making it easy to display durations in a readable format. Example: Humanizing TimeSpan using System; class TimeSpanHumanizerDemo { static void Main() { TimeSpan timeSpan = TimeSpan.FromMinutes(123); // Humanizing the TimeSpan into hours and minutes string humanizedTimeSpan = timeSpan.Humanize(2); // Output: "2 hours, 3 minutes" Console.WriteLine("Humanized TimeSpan: " + humanizedTimeSpan); } } using System; class TimeSpanHumanizerDemo { static void Main() { TimeSpan timeSpan = TimeSpan.FromMinutes(123); // Humanizing the TimeSpan into hours and minutes string humanizedTimeSpan = timeSpan.Humanize(2); // Output: "2 hours, 3 minutes" Console.WriteLine("Humanized TimeSpan: " + humanizedTimeSpan); } } $vbLabelText $csharpLabel Working with Numbers Humanizer provides several methods to convert numbers into human-readable words and to handle ordinal numbers. Example: Converting Numbers to Words using System; class NumberHumanizerDemo { static void Main() { int number = 123; // Convert number to words string words = number.ToWords(); // Output: "one hundred and twenty-three" Console.WriteLine("Number in Words: " + words); } } using System; class NumberHumanizerDemo { static void Main() { int number = 123; // Convert number to words string words = number.ToWords(); // Output: "one hundred and twenty-three" Console.WriteLine("Number in Words: " + words); } } $vbLabelText $csharpLabel Example: Converting Numbers to Ordinals using System; class OrdinalHumanizerDemo { static void Main() { int number = 21; // Convert number to ordinal words string ordinal = number.ToOrdinalWords(); // Output: "twenty-first" Console.WriteLine("Ordinal Number: " + ordinal); } } using System; class OrdinalHumanizerDemo { static void Main() { int number = 21; // Convert number to ordinal words string ordinal = number.ToOrdinalWords(); // Output: "twenty-first" Console.WriteLine("Ordinal Number: " + ordinal); } } $vbLabelText $csharpLabel Pluralization and Singularization Humanizer makes it easy to convert words between their singular and plural forms, which is useful for dynamically generating long text based on quantity. Example: Pluralizing and Singularizing Words using System; class PluralizationDemo { static void Main() { string singular = "car"; // Pluralize the word string plural = singular.Pluralize(); // Output: "cars" string word = "people"; // Singularize the word string singularForm = word.Singularize(); // Output: "person" Console.WriteLine("Plural of 'car': " + plural); Console.WriteLine("Singular of 'people': " + singularForm); } } using System; class PluralizationDemo { static void Main() { string singular = "car"; // Pluralize the word string plural = singular.Pluralize(); // Output: "cars" string word = "people"; // Singularize the word string singularForm = word.Singularize(); // Output: "person" Console.WriteLine("Plural of 'car': " + plural); Console.WriteLine("Singular of 'people': " + singularForm); } } $vbLabelText $csharpLabel Humanizer handles irregular pluralizations and singularizations as well, making it robust for various use cases. Formatting Enums Enums are frequently used in C# applications to represent a set of named constants. Humanizer can convert enum values to human-readable strings. Example: Humanizing Enums using System; public enum MyEnum { FirstValue, SecondValue } class EnumHumanizerDemo { static void Main() { MyEnum enumValue = MyEnum.FirstValue; // Humanizing enum to a readable format string humanizedEnum = enumValue.Humanize(); // Output: "First value" Console.WriteLine("Humanized Enum: " + humanizedEnum); } } using System; public enum MyEnum { FirstValue, SecondValue } class EnumHumanizerDemo { static void Main() { MyEnum enumValue = MyEnum.FirstValue; // Humanizing enum to a readable format string humanizedEnum = enumValue.Humanize(); // Output: "First value" Console.WriteLine("Humanized Enum: " + humanizedEnum); } } $vbLabelText $csharpLabel This method can be particularly useful for displaying user-friendly labels in UIs. Humanizing Byte Sizes Another handy feature of Humanizer is the ability to humanize byte sizes, converting large byte values into readable formats like KB, MB, or GB. Example: Humanizing Byte Sizes using System; class ByteSizeHumanizerDemo { static void Main() { long bytes = 1048576; // Humanize bytes to a readable size format string humanizedBytes = bytes.Bytes().Humanize(); // Output: "1 MB" Console.WriteLine("Humanized Byte Size: " + humanizedBytes); } } using System; class ByteSizeHumanizerDemo { static void Main() { long bytes = 1048576; // Humanize bytes to a readable size format string humanizedBytes = bytes.Bytes().Humanize(); // Output: "1 MB" Console.WriteLine("Humanized Byte Size: " + humanizedBytes); } } $vbLabelText $csharpLabel Advanced Scenarios Humanizer is not limited to the basic scenarios described above. It supports a wide range of advanced features such as the Truncate method and multiple languages and extensions. Example: Humanizing DateTime Offsets Humanizer can also handle DateTimeOffset, which is useful for applications dealing with time zones. using System; class DateTimeOffsetHumanizerDemo { static void Main() { DateTimeOffset dateTimeOffset = DateTimeOffset.Now.AddDays(-2); // Humanize DateTimeOffset string humanizedDateTimeOffset = dateTimeOffset.Humanize(); // Output: "2 days ago" Console.WriteLine("Humanized DateTimeOffset: " + humanizedDateTimeOffset); } } using System; class DateTimeOffsetHumanizerDemo { static void Main() { DateTimeOffset dateTimeOffset = DateTimeOffset.Now.AddDays(-2); // Humanize DateTimeOffset string humanizedDateTimeOffset = dateTimeOffset.Humanize(); // Output: "2 days ago" Console.WriteLine("Humanized DateTimeOffset: " + humanizedDateTimeOffset); } } $vbLabelText $csharpLabel Performance Considerations Humanizer is designed to be efficient, but like any library, its performance depends on how it is used. For applications requiring high performance, especially those dealing with large datasets or real-time processing, it is essential to consider the impact of frequent humanization operations. IronPDF for C# IronPDF is a comprehensive PDF generation and manipulation library for .NET applications. It enables developers to create, read, edit, and extract content from PDF files with ease. IronPDF is designed to be user-friendly, offering a wide range of functionalities including converting HTML to PDF, merging documents, adding watermarks, and much more. Its versatility and powerful features make it an excellent choice for handling PDF documents in C# projects. Installing IronPDF via NuGet Package Manager Follow these steps to install IronPDF using the NuGet Package Manager: Open Your Project in Visual Studio: Launch Visual Studio and open your existing C# project or create a new one. Open the NuGet Package Manager: Right-click on your project in the Solution Explorer. Select "Manage NuGet Packages…" from the context menu. Install IronPDF: In the NuGet Package Manager, go to the "Browse" tab. Search for IronPDF. Select the IronPDF package from the search results. Click the "Install" button to add IronPDF to your project. By following these steps, IronPDF will be installed and ready to use in your C# project, allowing you to leverage its powerful PDF manipulation capabilities. C# Humanizer and IronPDF Code Example using Humanizer; using IronPdf; using System; using System.Collections.Generic; class PDFGenerationDemo { static void Main() { // Instantiate the PDF renderer var renderer = new ChromePdfRenderer(); // Generate humanized content List<string> content = GenerateHumanizedContent(); // HTML content template for the PDF string htmlContent = "<h1>Humanizer Examples</h1><ul>"; // Build the list items to add to the HTML content foreach (var item in content) { htmlContent += $"<li>{item}</li>"; } htmlContent += "</ul>"; // Render the HTML into a PDF document var pdf = renderer.RenderHtmlAsPdf(htmlContent); // Save the PDF to a file pdf.SaveAs("output.pdf"); Console.WriteLine("PDF document generated successfully: output.pdf"); } /// <summary> /// Generates a list of humanized content examples /// </summary> /// <returns>List of humanized content as strings</returns> static List<string> GenerateHumanizedContent() { List<string> content = new List<string>(); // DateTime examples DateTime pastDate = DateTime.Now.AddDays(-3); DateTime futureDate = DateTime.Now.AddHours(5); content.Add($"DateTime.Now: {DateTime.Now}"); content.Add($"3 days ago: {pastDate.Humanize()}"); content.Add($"In 5 hours: {futureDate.Humanize()}"); // TimeSpan examples TimeSpan timeSpan = TimeSpan.FromMinutes(123); content.Add($"TimeSpan of 123 minutes: {timeSpan.Humanize()}"); // Number examples int number = 12345; content.Add($"Number 12345 in words: {number.ToWords()}"); content.Add($"Ordinal of 21: {21.ToOrdinalWords()}"); // Pluralization examples string singular = "car"; content.Add($"Plural of 'car': {singular.Pluralize()}"); string plural = "children"; content.Add($"Singular of 'children': {plural.Singularize()}"); // Byte size examples long bytes = 1048576; content.Add($"1,048,576 bytes: {bytes.Bytes().Humanize()}"); return content; } } using Humanizer; using IronPdf; using System; using System.Collections.Generic; class PDFGenerationDemo { static void Main() { // Instantiate the PDF renderer var renderer = new ChromePdfRenderer(); // Generate humanized content List<string> content = GenerateHumanizedContent(); // HTML content template for the PDF string htmlContent = "<h1>Humanizer Examples</h1><ul>"; // Build the list items to add to the HTML content foreach (var item in content) { htmlContent += $"<li>{item}</li>"; } htmlContent += "</ul>"; // Render the HTML into a PDF document var pdf = renderer.RenderHtmlAsPdf(htmlContent); // Save the PDF to a file pdf.SaveAs("output.pdf"); Console.WriteLine("PDF document generated successfully: output.pdf"); } /// <summary> /// Generates a list of humanized content examples /// </summary> /// <returns>List of humanized content as strings</returns> static List<string> GenerateHumanizedContent() { List<string> content = new List<string>(); // DateTime examples DateTime pastDate = DateTime.Now.AddDays(-3); DateTime futureDate = DateTime.Now.AddHours(5); content.Add($"DateTime.Now: {DateTime.Now}"); content.Add($"3 days ago: {pastDate.Humanize()}"); content.Add($"In 5 hours: {futureDate.Humanize()}"); // TimeSpan examples TimeSpan timeSpan = TimeSpan.FromMinutes(123); content.Add($"TimeSpan of 123 minutes: {timeSpan.Humanize()}"); // Number examples int number = 12345; content.Add($"Number 12345 in words: {number.ToWords()}"); content.Add($"Ordinal of 21: {21.ToOrdinalWords()}"); // Pluralization examples string singular = "car"; content.Add($"Plural of 'car': {singular.Pluralize()}"); string plural = "children"; content.Add($"Singular of 'children': {plural.Singularize()}"); // Byte size examples long bytes = 1048576; content.Add($"1,048,576 bytes: {bytes.Bytes().Humanize()}"); return content; } } $vbLabelText $csharpLabel Conclusion Humanizer is an indispensable library for .NET developers aiming to create applications that present information in a user-friendly and human-readable format. Its wide range of features, from date and time humanization to number and enum formatting, make it a versatile tool for improving the usability of applications. By leveraging Humanizer, developers can save time and effort in implementing custom formatting logic, ensuring that their applications communicate data more effectively to end-users. Similarly, IronPDF offers comprehensive PDF generation and manipulation capabilities, making it an excellent choice for creating and handling PDF documents in C# projects. Together, Humanizer and IronPDF can significantly enhance the functionality and presentation of .NET applications. For more details on IronPDF licensing, refer to the IronPDF Licensing Information. To explore further, check out our Detailed Tutorial on HTML to PDF Conversion. 자주 묻는 질문 C#에서 휴머나이저 라이브러리의 목적은 무엇인가요? C#의 휴머나이저 라이브러리는 날짜를 상대 시간 문자열로 변환하고, 단어를 복수화하고, 숫자를 단어로 서식을 지정하고, 열거 형식을 처리하는 등 데이터를 인간 친화적인 형식으로 변환하도록 설계되었습니다. 이를 통해 개발자는 데이터를 더 읽기 쉽고 접근하기 쉬운 방식으로 표시할 수 있습니다. C#에서 날짜 시간을 상대 시간 문자열로 변환하려면 어떻게 해야 하나요? 휴머나이저의 Humanize 메서드를 사용하여 날짜/시간 객체를 '3일 전' 또는 '5시간 후'와 같은 상대적인 시간 문자열로 변환할 수 있습니다. C# 프로젝트에 휴머나이저 라이브러리를 설치하려면 어떻게 해야 하나요? C# 프로젝트에 휴머나이저 라이브러리를 설치하려면 NuGet 패키지 관리자 콘솔에서 Install-Package Humanizer 명령을 사용하거나 .NET Core CLI에서 dotnet add package Humanizer 명령을 사용하면 됩니다. 휴머나이저로 가능한 데이터 변환의 예에는 어떤 것이 있나요? 휴머나이저는 파스칼 대소문자 문자열을 문장으로 변환하고, 밑줄이 그어진 문자열을 제목 대소문자로 변환하고, 긴 텍스트를 지정된 길이로 자르는 등 여러 가지 데이터 변환을 수행할 수 있습니다. 휴머니마이저가 C#에서 단어의 복수화를 도울 수 있나요? 예, 휴머니마이저는 단어를 복수화 및 단수화하는 방법을 제공하여 'car'를 'cars'로, 'people'을 'person'으로 변환하는 등 정규 및 불규칙 형태를 모두 효과적으로 처리할 수 있습니다. 휴머니마이저는 C#에서 열거형을 어떻게 처리하나요? 휴머니마이저는 열거형 값을 사람이 읽을 수 있는 문자열로 변환하여 인터페이스에 사용자 친화적인 레이블을 더 쉽게 표시할 수 있습니다. C# PDF 라이브러리는 어떤 기능을 제공하나요? IronPDF와 같은 C# PDF 라이브러리는 PDF 파일에서 콘텐츠를 생성, 읽기, 편집, 추출하는 등의 기능을 제공합니다. 또한 HTML을 PDF로 변환하고, 문서를 병합하고, 워터마크를 추가할 수 있습니다. 프로젝트에 C# PDF 라이브러리를 설치하려면 어떻게 해야 하나요? C# PDF 라이브러리를 설치하려면 '찾아보기' 탭에서 IronPDF와 같은 라이브러리 이름을 검색하고 '설치'를 클릭하여 NuGet 패키지 관리자를 사용할 수 있습니다. 휴머나이저와 C#의 PDF 라이브러리를 결합하면 어떤 이점이 있나요? 개발자는 휴머나이저와 IronPDF와 같은 PDF 라이브러리를 결합하여 휴머나이저로 사람이 읽을 수 있는 콘텐츠를 생성한 다음 이를 PDF 문서로 렌더링하여 사용자 친화적인 PDF 보고서 및 문서를 쉽게 만들 수 있습니다. 휴머나이저를 사용할 때 성능과 관련하여 고려해야 할 사항은 무엇인가요? 휴머나이저는 효율적으로 설계되었지만 개발자는 대규모 데이터 세트나 실시간 처리로 고성능이 필요한 애플리케이션에서 빈번한 인간화 작업의 영향을 고려해야 합니다. 커티스 차우 지금 바로 엔지니어링 팀과 채팅하세요 기술 문서 작성자 커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다. 커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다. 관련 기사 업데이트됨 12월 11, 2025 Bridging CLI Simplicity & .NET : Using Curl DotNet with IronPDF Jacob Mellor has bridged this gap with CurlDotNet, a library created to bring the familiarity of cURL to the .NET ecosystem. 더 읽어보기 업데이트됨 12월 20, 2025 RandomNumberGenerator C# Using the RandomNumberGenerator C# class can help take your PDF generation and editing projects to the next level 더 읽어보기 업데이트됨 12월 20, 2025 C# String Equals (How it Works for Developers) When combined with a powerful PDF library like IronPDF, switch pattern matching allows you to build smarter, cleaner logic for document processing 더 읽어보기 TensorFlow .NET (How It Works For Developers)OpenAPI .NET (How It Works For Deve...
업데이트됨 12월 11, 2025 Bridging CLI Simplicity & .NET : Using Curl DotNet with IronPDF Jacob Mellor has bridged this gap with CurlDotNet, a library created to bring the familiarity of cURL to the .NET ecosystem. 더 읽어보기
업데이트됨 12월 20, 2025 RandomNumberGenerator C# Using the RandomNumberGenerator C# class can help take your PDF generation and editing projects to the next level 더 읽어보기
업데이트됨 12월 20, 2025 C# String Equals (How it Works for Developers) When combined with a powerful PDF library like IronPDF, switch pattern matching allows you to build smarter, cleaner logic for document processing 더 읽어보기