Skip to content

Commit 90614a7

Browse files
committed
Update readme.
1 parent 671332e commit 90614a7

File tree

1 file changed

+154
-2
lines changed

1 file changed

+154
-2
lines changed

README.md

Lines changed: 154 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,98 +26,250 @@ PM> Install-Package FluentExtensions.NET
2626
#### Extensions to Numbers
2727

2828
```c#
29+
// Determines whether the given target is even.
2930
bool IsEven(this int source);
31+
32+
// Determines whether the given target is odd.
3033
bool IsOdd(this int source);
34+
35+
// Determines whether the current number is greater than the target one.
3136
bool IsGreaterThan(this int source, int target);
37+
38+
// Determines whether the current number is less than the target one.
3239
bool IsLessThan(this int source, int target);
40+
41+
// Determines whether the current number is equal to the target one.
3342
bool IsEqualTo(this int source, int target);
43+
44+
// Gets the date time in past from given number of days.
3445
DateTime DaysAgo(this int days);
46+
47+
// Gets the date time in future from given number of days.
3548
DateTime DaysAfter(this int days);
49+
50+
// Gets the date time in past from given number of weeks.
3651
DateTime WeeksAgo(this int weeks);
52+
53+
// Gets the date time in future from given number of weeks.
3754
DateTime WeeksAfter(this int weeks);
55+
56+
// Converts the given number into days.
3857
DateTime Days(this int num);
58+
59+
// Gets the date time in future from given number of months.
3960
DateTime MonthsAfter(this int months);
61+
62+
// Gets the date time in past from given number of months.
4063
DateTime MonthsAgo(this int months);
64+
65+
// Gets the date time in past from given number of years.
4166
DateTime YearsAgo(this int years);
67+
68+
// Gets the date time in future from given number of years.
4269
DateTime YearsAfter(this int years);
70+
71+
// Determines whether the given year is a leap year.
4372
bool IsLeapYear(this int year);
73+
74+
// Gets the next leap year based on the given year.
4475
int NextLeapYear(this int year);
76+
77+
// Gets the previous leap year based on the given year.
4578
int PreviousLeapYear(this int year);
79+
80+
// Converts byte array to base64 string.
4681
string FromByeArrayToBase64(this byte[] source, Base64FormattingOptions options = Base64FormattingOptions.None);
82+
83+
// Separates every 3 number by comma.
4784
string SeparateThousandsByComma(this int source);
85+
86+
// Separates every 3 number by comma.
4887
string SeparateThousandsByComma(this int source, CultureInfo culture);
88+
89+
// Generating Random Numbers.
4990
string RandomDigits(this int length);
91+
92+
// Generating Random Numbers.
5093
string GenerateRandomString(this int length, bool isUpperCase = false, bool containNumbers = false);
5194
```
5295

5396
#### Extensions to Strings
5497

5598
```c#
99+
// Determines whether the given string is Integer.
56100
bool IsInt(this string source);
101+
102+
// Determines whether the given string is Double.
57103
bool IsDouble(this string source);
104+
105+
// Determines whether the given string is Decimal.
58106
bool IsDecimal(this string source);
107+
108+
// Determines whether the given string is Boolean.
59109
IsBoolean(this string source);
110+
111+
// Determines whether the given string is Date.
60112
bool IsDate(this string source);
113+
114+
// Gets string between two strings.
115+
// Credits: https://stackoverflow.com/a/28723216/12352466
61116
string GetInBetween(this string source, string start, string end);
117+
118+
// Converts given text into title case text.
62119
string ToTitleCase(this string source);
120+
121+
// Converts given text into title case text.
63122
string ToTitleCase(this string source, CultureInfo culture);
123+
124+
// Converts string type (True | False) to boolean.
64125
bool ToBoolean(this string source);
126+
127+
// Determines whether the given string contains digit(s).
65128
bool IsContainDigits(this string source);
129+
130+
// Determines whether the given string contains letter(s).
66131
bool IsContainLetters(this string source);
132+
133+
// Determines whether all characters of the given text are digits.
67134
bool AreAllDigits(this string source);
135+
136+
// Determines whether all characters of the given text are letters.
68137
bool AreAllLetters(this string source);
138+
139+
// Converts back base64 string to byte array;
69140
byte[] FromBase64ToByteArray(this string source);
141+
142+
// Converts string to byte array.
70143
byte[] GetBytes(this string source);
144+
145+
// Converts string to byte array.
71146
byte[] GetBytes(this string source, EncodingType encodingType);
147+
148+
// Determines whether the given text is null or whitespace or empty.
72149
bool IsEmpty(this string source);
150+
151+
// Gets the extension of the file.
73152
string GetFileExtension(this string filePath);
153+
154+
// Determines whether the file exists.
74155
bool FileExists(this string filePath);
156+
157+
// Gets the content of the text file.
75158
ToFileInDisk(this string source, string path);
159+
160+
// Gets the content of the text file asynchronously.
76161
Task ToFileInDiskAsync(this string source, string path);
162+
163+
// Gets the content of the text file.
77164
string ReadFromDisk(this string path);
165+
166+
// Gets the content of the text file asynchronously.
78167
Task<string> ReadFromDiskAsync(this string path);
79168
```
80169

81170
#### Extensions to DateTime
82171

83172
```c#
173+
// Gets the day after given date.
84174
DateTime Tomorrow(this DateTime current);
175+
176+
// Gets the day before given date.
85177
DateTime Yesterday(this DateTime current);
178+
179+
// Gets an hour after the given date.
86180
DateTime NextHour(this DateTime current);
181+
182+
// Gets an hour before the given date.
87183
DateTime LastHour(this DateTime current);
184+
185+
// Gets a week after the given date.
88186
DateTime NextWeek(this DateTime current);
187+
188+
// Gets a week before the given date.
89189
DateTime LastWeek(this DateTime current);
190+
191+
// Gets a month before the given date.
90192
static DateTime LastMonth(this DateTime current);
193+
194+
// Gets a month after the given date.
91195
DateTime NextMonth(this DateTime current);
196+
197+
// Gets a year before the given date.
92198
DateTime LastYear(this DateTime current);
199+
200+
// Gets a year after the given date.
93201
DateTime NextYear(this DateTime current);
202+
203+
// Gets the number of days prior to the given date.
94204
DateTime DaysAgo(this DateTime source, int days);
205+
206+
// Gets the number of days after the given date.
95207
DateTime DaysAfter(this DateTime source, int days);
208+
209+
// Gets the number of weeks prior the given date.
96210
DateTime WeeksAgo(this DateTime source, int weeks);
211+
212+
// Gets the number of weeks after the given date.
97213
DateTime WeeksAfter(this DateTime source, int weeks);
214+
215+
// Gets the number of months prior the given date.
98216
DateTime MonthsAgo(this DateTime source, int months);
217+
218+
// Gets the number of months after the given date.
99219
DateTime MonthsAfter(this DateTime source, int months);
220+
221+
// Gets the number of years prior the given date.
100222
DateTime YearsAgo(this DateTime source, int years);
223+
224+
// Gets the number of years after the given date.
101225
static DateTime YearsAfter(this DateTime source, int years);
226+
227+
// Gets the first day of month.
102228
DateTime FirstDayOfMonth(this DateTime date);
229+
230+
// Gets the last day of month.
103231
DateTime LastDayOfMonth(this DateTime date);
232+
233+
// Gets the number of days left to the target date.
104234
double DaysLeft(this DateTime source, DateTime target);
235+
236+
// Gets the number of the days of the given date month.
105237
int DaysInMonth(this DateTime date);
106-
bool IsBetween(this DateTime dateToCompare,
107-
DateTime startDate, DateTime endDate);
238+
239+
// Determines whether the given date is between the two given dates.
240+
bool IsBetween(this DateTime dateToCompare, DateTime startDate, DateTime endDate);
241+
242+
// Determines whether the given date is before the target one.
108243
bool IsBefore(this DateTime dateToCompare, DateTime target);
244+
245+
// Determines whether the given date is already passed the target one.
109246
bool IsAfter(this DateTime dateToCompare, DateTime target);
247+
248+
// Determines whether the given date is a leap year.
110249
bool IsYearLeap(this DateTime date);
250+
251+
// Gets the Next leap year based on the given date.
111252
DateTime NextLeapYear(this DateTime date);
253+
254+
// Gets the previous leap year based on the given date.
112255
DateTime PreviousLeapYear(this DateTime date);
256+
257+
// Calculates age based on given date.
113258
int GetAge(this DateTime date);
259+
260+
// Gets the name of the given date time.
114261
string DayName(this DateTime current);
115262
```
116263

117264
#### Extensions to Lists
118265

119266
```c#
267+
// Changes a list from mutable (Changeable) to immutable(Not changeable).
120268
IEnumerable<T> ToImmutableList<T>(this IEnumerable<T> sourceList);
269+
270+
// Replaces a list items with another ones items.
121271
static IEnumerable<T> ReplaceWith<T>(this IList<T> sourceList, IEnumerable<T> targetList);
272+
273+
// Picks one item through the list randomly.
122274
T PickRandomItem<T>(this IList<T> sourceList);
123275
```

0 commit comments

Comments
 (0)