TechArt 1.0.1
dotnet add package TechArt --version 1.0.1
NuGet\Install-Package TechArt -Version 1.0.1
<PackageReference Include="TechArt" Version="1.0.1" />
paket add TechArt --version 1.0.1
#r "nuget: TechArt, 1.0.1"
// Install TechArt as a Cake Addin #addin nuget:?package=TechArt&version=1.0.1 // Install TechArt as a Cake Tool #tool nuget:?package=TechArt&version=1.0.1
TechArt TechArt is a library that provides various extension methods for string manipulation, date/time calculations, formatting, and more.
Installation Install the package using the NuGet package manager or by running the following command in the Package Manager Console:
Usage String Extensions Slugify string slug = "Hello World!".Slugify(); // Output: "hello-world-<12-character-guid>"
string reference = "Reference".GenerateRef(); // Output: "Reference<10-character-uppercase-guid>" string referralCode = "Code".GenerateReferralCode(); // Output: "Code<7-character-uppercase-guid>" bool value = true; string yesNo = value.ToYesNo(); // Output: "Yes" bool value = false; string trueFalse = value.ToTrueFalse(); // Output: "False" enum Status { [Description("Active status")] Active, [Description("Inactive status")] Inactive }
Status status = Status.Active; string description = status.GetDescription(); // Output: "Active status" DateTime birthdate = new DateTime(1990, 1, 1); int age = birthdate.ToAge(); // Output: <current age based on birthdate> DateTime pastDate = DateTime.Now.AddHours(-3); string timeAgo = pastDate.TimeAgo(); // Output: "3 hours ago" long number = 1500000; string formattedNumber = number.LongToNumberFormat(); // Output: "1.5M"
Available methods and their usages
- slugify(this string str): Generates a Slug text from a string.
- GenerateRef(this string str): Generate References, appends random text to a specified text.
- GenerateReferralCode(this string str): Generates ReferralCode.
- ToYesNo(this bool value): Converts a Boolean Value to Yes or No string.
- ToTrueFalse(this bool value): Converts a Boolean Value to Yes or No string.
- GetDescription(this Enum value): Gets an Enum string description.
- ToAge(this DateTime date): Gets age calculation for the specified date.
- TimeAgo(this DateTime date): Gets the time ago calculation for the specified date.
- LongToNumberFormat(this long num): Formats Long to String format 1H, 1K, 1M, 1B, 1T.
- GetSubjectId(this IPrincipal principal): gets the subjectID for a principal.
- GetSubjectId(this IIdentity identity): gets the subjectID for an Identity.
- List<T> ToPageSize<T>(this List<T> records, int pageIndex, int pageSize): Generates the Page Sized List of Records or Entities Needed.
The following responses are available for your API modelling.
- BaseResponse<T>().CreateResponse(string message, bool status, T object).
- PaginatedResponse<T>{Items ⇒ List<T>, TotalRecords, CurrentPage, PageSize }
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- AspNetCoreHero.Results (>= 1.1.1)
- AspNetCoreHero.ThrowR (>= 1.0.0)
- Microsoft.EntityFrameworkCore (>= 8.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.