Skip to content

Commit fd9f6ce

Browse files
committed
Update README.md
1 parent 904f791 commit fd9f6ce

File tree

5 files changed

+91
-39
lines changed

5 files changed

+91
-39
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<br/>
77

88
# FluentExtensions
9+
910
Fluent Extensions is a set of more than 100 .NET extensions, it especially made for helping developers to focus on the main tasks rather than get distracted by writing the same code again and again for simple actions, FluentExtensions akso increases readability.
1011

1112
### Install FluentExtensions via NuGet
@@ -20,12 +21,26 @@ PM> Install-Package FluentExtensions.NET
2021
```
2122

2223
### Documentations
24+
2325
> [Docs](https://d-diyare.github.io/FluentExtensions/)
2426
2527
### Extensions
2628

2729
#### Extensions to Numbers
2830

31+
```c#
32+
// Converts boolean value to either "yes" or "No".
33+
string ToYesNo(this bool source);
34+
35+
// Executes an action while the given boolean value is equal to target value.
36+
void DoOn(this bool source, bool result, Action execute);
37+
38+
39+
40+
```
41+
42+
#### Extensions to Numbers
43+
2944
```c#
3045
// Determines whether the given target is even.
3146
bool IsEven(this int source);
@@ -148,7 +163,7 @@ string ToTitleCase(this string source);
148163
// Converts given text into title case text.
149164
string ToTitleCase(this string source, CultureInfo culture);
150165

151-
// Converts string type (True | False) to boolean.
166+
// Converts string type (True | False) to boolean.
152167
bool ToBoolean(this string source);
153168

154169
// Determines whether the given string contains digit(s).
@@ -199,7 +214,7 @@ string AddToEnd(this string text, string textToAdd, bool addSpaceBeforeAddition
199214
// Adds text to start of another text.
200215
string AddToStart(this string text, string textToAdd, bool addSpaceAfterAddition = true);
201216

202-
// Gets portion of string based on given characters and position to get.
217+
// Gets portion of string based on given characters and position to get.
203218
string Take(this string source, int characters, Position from = Position.Start);
204219

205220
// Replaces multiple values inside a string with one value.
@@ -244,6 +259,11 @@ double FileSizeInKB(this string filePath);
244259
// Gets the file size in megabytes.
245260
double FileSizeInMB(this string filePath);
246261

262+
// Reads the file content as array of bytes.
263+
byte[] ReadBytesFromDisk(this string filePath);
264+
265+
// Reads the file content as array of bytes asynchronously.
266+
Task<byte[]> ReadBytesFromDiskAsync(this string filePath)
247267

248268
```
249269

@@ -352,4 +372,10 @@ static IEnumerable<T> ReplaceWith<T>(this IList<T> sourceList, IEnumerable<T> ta
352372

353373
// Picks one item through the list randomly.
354374
T PickRandomItem<T>(this IList<T> sourceList);
375+
376+
// Joins string array into a single string separated via delimiter.
377+
string Join(this IEnumerable<string> texts, string delimiter);
378+
379+
// Converts IEnumerable to list, if it is already a List it returns the list itself.
380+
IList<T> AsList<T>(IEnumerable<T> sourceList);
355381
```

src/FluentExtensions/FluentExtensions.csproj

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,9 @@
99
<RepositoryType>git</RepositoryType>
1010
<PackageReadmeFile>README.md</PackageReadmeFile>
1111
<PackageTags>extension, datetime, date, dotnet, extension-methods, fluent, string-matching, stringextensions, fluentextension, fluentextensions, numericxtensions</PackageTags>
12-
<PackageReleaseNotes>
13-
New Extensions Added:
14-
- public static string DriveFreeSpace(this string driveLetter);
15-
- public static string DriveTotalSize(this string driveLetter);
16-
- public static string DriveFormat(this string driveLetter);
17-
- public static DriveType DriveType(this string driveLetter);
18-
- public static void DeleteFile(this string filePath);
19-
- public static void HideFile(this string filePath);
20-
- public static void ShowFile(this string filePath);
21-
- public static DateTime CreatedDate(this string filePath);
22-
- public static void CopyFile(this string filePath, string destination);
23-
- public static void MoveFile(this string filePath, string destination);
24-
- public static double FileSizeInKB(this string filePath);
25-
- public static double FileSizeInMB(this string filePath);
26-
27-
Fixes
28-
- Fix digital storage measurements.
29-
</PackageReleaseNotes>
12+
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/release-notes.txt"))</PackageReleaseNotes>
3013
<PackageProjectUrl>https://github.com/D-Diyare/FluentExtensions</PackageProjectUrl>
31-
<Version>1.3</Version>
14+
<Version>1.4</Version>
3215
<Copyright>Copyright © Diyare Abdulla 2021</Copyright>
3316
<Title>FluentExtensions</Title>
3417
<PackageLicenseExpression>MIT</PackageLicenseExpression>

src/FluentExtensions/ListEx.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,23 @@ public static T PickRandomItem<T>(this IList<T> sourceList)
6464
return sourceList[randomize.Next(1, sourceList.Count)];
6565
}
6666

67+
/// <summary>
68+
/// Joins string array into a single string separated via delimiter.
69+
/// </summary>
70+
/// <param name="texts">string array to join.</param>
71+
/// <param name="delimiter">delimiter to join strings with (eg: , ).</param>
72+
/// <returns>A Single string based on given array.</returns>
73+
public static string Join(this IEnumerable<string> texts, string delimiter)
74+
{
75+
var str = new StringBuilder();
76+
foreach (var text in texts)
77+
{
78+
str.Append($"{text}{delimiter}");
79+
}
80+
81+
return str.ToString();
82+
}
83+
6784
/// <summary>
6885
/// Converts IEnumerable to list, if it is already a List it returns the list itself.
6986
/// </summary>

src/FluentExtensions/StringEx.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Globalization;
43
using System.IO;
54
using System.Linq;
@@ -544,23 +543,6 @@ public static double FileSizeInMB(this string filePath)
544543
return Math.Round(fileSizeInMB, 3, MidpointRounding.AwayFromZero);
545544
}
546545

547-
/// <summary>
548-
/// Joins string array into a single string separated via delimiter.
549-
/// </summary>
550-
/// <param name="texts">string array to join.</param>
551-
/// <param name="delimiter">delimiter to join strings with (eg: , ).</param>
552-
/// <returns>A Single string based on given array.</returns>
553-
public static string Join(this IEnumerable<string> texts, string delimiter)
554-
{
555-
var str = new StringBuilder();
556-
foreach (var text in texts)
557-
{
558-
str.Append($"{text}{delimiter}");
559-
}
560-
561-
return str.ToString();
562-
}
563-
564546
/// <summary>
565547
/// Reads the file content as array of bytes.
566548
/// </summary>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
v.1.4.0
2+
New Extensions Added:
3+
- string Join(this IEnumerable<string> texts, string delimiter);
4+
- byte[] ReadBytesFromDisk(this string filePath);
5+
- Task<byte[]> ReadBytesFromDiskAsync(this string filePath);
6+
- IList<T> AsList<T>(IEnumerable<T> sourceList);
7+
- string ToYesNo(this bool source);
8+
- void DoOn(this bool source, bool result, Action execute);
9+
10+
v.1.3.0
11+
New Extensions Added:
12+
- string DriveFreeSpace(this string driveLetter);
13+
- string DriveTotalSize(this string driveLetter);
14+
- string DriveFormat(this string driveLetter);
15+
- DriveType DriveType(this string driveLetter);
16+
- void DeleteFile(this string filePath);
17+
- void HideFile(this string filePath);
18+
- void ShowFile(this string filePath);
19+
- DateTime CreatedDate(this string filePath);
20+
- void CopyFile(this string filePath, string destination);
21+
- void MoveFile(this string filePath, string destination);
22+
- double FileSizeInKB(this string filePath);
23+
- double FileSizeInMB(this string filePath);
24+
25+
Fixes:
26+
- Fix digital storage measurements.
27+
28+
v.1.2.0
29+
New Extensions Added:
30+
- string AddToEnd(this string text, string textToAdd, bool addSpaceBeforeAddition = true);
31+
- string AddToStart(this string text, string textToAdd, bool addSpaceafterAddition = true);
32+
- string ReplaceMultipleWithOne(this string source, string[] values, string value)
33+
- string Take(this string source, int characters, Position from = Position.Start);
34+
- double ToKB(this int number, DigitalStorage from = DigitalStorage.KB);
35+
- double ToMB(this int number, DigitalStorage from = DigitalStorage.MB);
36+
- double ToGB(this int number, DigitalStorage from = DigitalStorage.GB);
37+
- double ToTB(this int number, DigitalStorage from = DigitalStorage.TB);
38+
39+
v.1.1.0
40+
- Fix Misspellings.
41+
- Update icon.
42+
43+
v.1.0.0
44+
- Initial release.

0 commit comments

Comments
 (0)