Skip to content

Commit 4704ac6

Browse files
committed
v8.2.0
1 parent 9523590 commit 4704ac6

File tree

15 files changed

+119
-73
lines changed

15 files changed

+119
-73
lines changed

README.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@
3636
## 📥 Installation
3737

3838
### Package Manager
39+
3940
```
4041
PM> NuGet\Install-Package Tynab.YANLib
4142
```
4243

4344
### .NET CLI
45+
4446
```
4547
dotnet add package Tynab.YANLib
4648
```
4749

4850
### Package Reference
51+
4952
```xml
5053
<PackageReference Include="Tynab.YANLib" Version="x.x.x" />
5154
```
@@ -80,7 +83,6 @@ A comprehensive utility library for object operations and validations, offering
8083
- Collection operations
8184
- Object manipulation (copy, time zone conversion)
8285

83-
8486
```csharp
8587
// Null checking
8688
object? obj = null;
@@ -107,7 +109,6 @@ A powerful utility library for parsing and converting objects to unmanaged types
107109
- Collection parsing with robust error handling
108110
- Format support for date/time and culture-specific parsing
109111

110-
111112
```csharp
112113
// Parse string to int
113114
object input = "123";
@@ -133,7 +134,6 @@ A versatile utility library for converting collections of objects to strongly-ty
133134
- Immutable collection support
134135
- Type parsing during conversion
135136

136-
137137
```csharp
138138
// Convert collection of objects to array of integers
139139
IEnumerable<object?> input = ["1", "2", "3"];
@@ -161,7 +161,6 @@ A comprehensive utility library for text manipulation, character operations, and
161161
- Collection text operations
162162
- Nullable character support
163163

164-
165164
```csharp
166165
// Case conversion
167166
string text = "hello world";
@@ -191,7 +190,6 @@ A comprehensive utility library for JSON serialization and deserialization, supp
191190
- Default formatting with camel case property naming
192191
- Error handling for serialization/deserialization errors
193192

194-
195193
```csharp
196194
// Serialize an object to a JSON string
197195
var person = new Person { Id = 1, Name = "John Doe" };
@@ -219,7 +217,6 @@ A comprehensive utility library for mathematical operations, providing extension
219217
- Trigonometric functions (Sin, Cos, Tan, Asin, Acos, Atan)
220218
- Logarithmic and exponential functions
221219

222-
223220
```csharp
224221
// Statistical functions
225222
double min = YANMath.Min(5.2, 3.1, 7.8, 2.4); // Returns 2.4
@@ -244,7 +241,6 @@ A comprehensive utility library for DateTime operations, offering methods for we
244241
- Collection operations
245242
- Generic type support
246243

247-
248244
```csharp
249245
// Get week number for a specific date
250246
var date = new DateTime(2023, 6, 15);
@@ -271,7 +267,6 @@ A comprehensive utility library for generating random values of various types, s
271267
- Collection operations for generating random collections
272268
- Type flexibility with generic support
273269

274-
275270
```csharp
276271
// Generate random values of various types
277272
int randomInt = YANRandom.GenerateRandom<int>(); // Random int
@@ -296,7 +291,6 @@ A specialized utility library that extends the Task Parallel Library (TPL), prov
296291
- Error handling with exception safety
297292
- Cancellation support
298293

299-
300294
```csharp
301295
// Wait for any task that returns a value greater than 5
302296
var tasks = new[]
@@ -327,7 +321,6 @@ A specialized utility library for managing system processes, focusing on process
327321
- Asynchronous operations
328322
- Process cleanup with automatic resource disposal
329323

330-
331324
```csharp
332325
// Kill all instances of a process with a specific name
333326
await "notepad".KillAllProcessesByName();
@@ -339,6 +332,7 @@ var processNames = new List<string?>
339332
"calc",
340333
"mspaint"
341334
};
335+
342336
await processNames.KillAllProcessesByNames();
343337
```
344338

@@ -353,7 +347,6 @@ A specialized utility library for creating and manipulating strongly-typed expre
353347
- Value type handling with automatic boxing
354348
- Expression caching for better performance
355349

356-
357350
```csharp
358351
// Create a property expression for accessing the Name property on a Person object
359352
var expression = YANExpression.PropertyExpression<Person>("p", "Name");
@@ -364,6 +357,7 @@ var person = new Person { Name = "John", Age = 30 };
364357
string name = (string)func(person); // Returns "John"
365358
```
366359

360+
367361
## 📊 Performance Benchmarks
368362

369363
YANLib is designed with performance in mind. The library uses various optimizations to ensure high performance:
@@ -373,14 +367,15 @@ YANLib is designed with performance in mind. The library uses various optimizati
373367
- Parallel processing for large collections where appropriate
374368
- Optimized algorithms for common operations
375369

376-
377370
### JSON Performance
378371

379372
YANJson is built on System.Text.Json, which offers significantly better performance compared to Newtonsoft.Json, especially for large datasets.
380373

381-
`<div align="center">
374+
<div align="center">
382375
<img src='https://raw.githubusercontent.com/Tynab/YANLib/refs/heads/main/pic/1.jpg' alt="JSON Performance Comparison">
383-
</div>`System.Text.Json is designed to provide better performance and security compared to other JSON libraries. It supports advanced features like parallel parsing and support for new data types such as Span and Utf8JsonReader, enabling faster data processing and reduced memory usage.
376+
</div>
377+
378+
System.Text.Json is designed to provide better performance and security compared to other JSON libraries. It supports advanced features like parallel parsing and support for new data types such as Span and Utf8JsonReader, enabling faster data processing and reduced memory usage.
384379

385380
Based on performance benchmark tests conducted in different environments and scenarios, System.Text.Json is generally considered to have the best performance among these libraries. According to performance tests, the results show that System.Text.Json has significantly faster JSON-to-.NET object and vice versa conversion times compared to Newtonsoft.Json, especially in cases with large data.
386381

@@ -402,9 +397,12 @@ However, using these options can affect performance. YANJson provides optimized
402397
For the most recent performance benchmarks, visit:
403398
[https://yanlib.yamiannephilim.com/api/json/yan-vs-standards?quantity=10000&hideSystem=true](https://yanlib.yamiannephilim.com/api/json/yan-vs-standards?quantity=10000&hideSystem=true)
404399

405-
`<div align="center">
400+
<div align="center">
406401
<img src='https://raw.githubusercontent.com/Tynab/YANLib/refs/heads/main/pic/0.jpg' alt="YAN vs Standards Performance">
407-
</div>`## 💻 Code Examples
402+
</div>
403+
404+
405+
## 💻 Code Examples
408406

409407
### Data Processing Pipeline
410408

@@ -512,6 +510,7 @@ public double CalculateStatistics(IEnumerable<double> values)
512510
}
513511
```
514512

513+
515514
## 🏗️ Project Architecture
516515

517516
YANLib is based on .NET 8.0 (LTS) and consists of the following main components:
@@ -530,7 +529,6 @@ YANLib is based on .NET 8.0 (LTS) and consists of the following main components:
530529
- Process
531530
- Expression
532531

533-
534532
### Project Structure
535533

536534
```plaintext

lib/YANLib/Footer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[Releases](https://github.com/tynab/YANLib/releases) |
88
[Package](https://www.nuget.org/packages/Tynab.YANLib)
99

10-
<sub>YANLib © 2023 - Documentation last updated: May 4, 2025</sub>
10+
<sub>YANLib © 2023 - Documentation last updated: May 12, 2025</sub>
1111

1212
<sub>Licensed under the [MIT License](https://github.com/tynab/YANLib/blob/main/LICENSE)</sub>
1313

lib/YANLib/Home.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
Welcome to the YANLib documentation! YANLib is a comprehensive .NET utility library that provides a wide range of extension methods and helper classes to simplify common programming tasks and enhance developer productivity.
44

5+
56
## Overview
67

78
YANLib offers a collection of specialized components, each focusing on a specific area of functionality. The library is designed with a consistent API, robust error handling, and support for both nullable and non-nullable types. All components are implemented as extension methods, allowing for a fluent and intuitive coding experience.
89

10+
911
## Key Components
1012

1113
### [YANObject](YANObject)
@@ -193,6 +195,7 @@ var processNames = new List<string?>
193195
"calc",
194196
"mspaint"
195197
};
198+
196199
await processNames.KillAllProcessesByNames();
197200
```
198201

@@ -252,6 +255,7 @@ using YANLib;
252255

253256
Now you can start using any of the extension methods provided by the library.
254257

258+
255259
## Examples
256260

257261
### Data Processing Pipeline
@@ -355,6 +359,7 @@ public double CalculateStatistics(IEnumerable<double> values)
355359
}
356360
```
357361

362+
358363
## Contributing
359364

360365
Contributions to YANLib are welcome! Please feel free to submit issues, feature requests, or pull requests to help improve the library.

lib/YANLib/YANDateTime.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
### YANDateTime - DateTime Operations Utility Library
22

3+
34
## Overview
45

56
`YANDateTime` is a comprehensive utility library that provides extension methods for working with DateTime objects in C# applications. It offers a wide range of date and time operations for both single DateTime values and collections, with support for generic types and null-safe operations.
67

8+
79
## Features
810

911
The library is organized into several functional categories:
@@ -21,7 +23,6 @@ The library is organized into several functional categories:
2123
- **Parallel Processing**: Automatic parallel processing for large collections (1000+ elements)
2224
- **Null Handling**: Graceful handling of null values in collections
2325

24-
2526
### Type Flexibility
2627

2728
- **Generic Support**: Process objects of any type that can be converted to DateTime
@@ -118,6 +119,7 @@ var dates = new DateTime?[]
118119
new DateTime(2023, 6, 15),
119120
new DateTime(2023, 12, 31)
120121
};
122+
121123
var weekNumbers = dates.GetWeekOfYears<int>()?.ToArray(); // Returns [1, 24, 53]
122124
123125
// Handle null values in collections
@@ -127,6 +129,7 @@ var datesWithNull = new DateTime?[]
127129
null,
128130
new DateTime(2023, 12, 31)
129131
};
132+
130133
var weeksWithNull = datesWithNull.GetWeekOfYears<int>()?.ToArray(); // Returns [1, 0, 53]
131134
132135
// Change time zone for a list of dates (modifies the list in-place)
@@ -136,6 +139,7 @@ var dateList = new List<DateTime>
136139
new(2023, 6, 15, 12, 0, 0),
137140
new(2023, 12, 31, 14, 0, 0)
138141
};
142+
139143
dateList.ChangeTimeZone(0, 2); // Modifies list to [2023-1-1 12:00, 2023-6-15 14:00, 2023-12-31 16:00]
140144
141145
// Change time zone for an enumerable (returns a new collection)
@@ -145,6 +149,7 @@ var dateArray = new DateTime[]
145149
new(2023, 6, 15, 12, 0, 0),
146150
new(2023, 12, 31, 14, 0, 0)
147151
};
152+
148153
var convertedDates = dateArray.ChangeTimeZones(0, 3)?.ToArray(); // Returns new collection with converted dates
149154
150155
// Process collections of objects that can be converted to DateTime
@@ -154,6 +159,7 @@ var objectDates = new object?[]
154159
"2023-06-15",
155160
1672444800000 // Unix timestamp
156161
};
162+
157163
var objectWeeks = objectDates.GetWeekOfYears<int>()?.ToArray(); // Returns [1, 24, ...]
158164
159165
// Process non-generic collections
@@ -182,6 +188,7 @@ var mixedObjects = new List<object?>
182188
"2023-06-15 12:00:00",
183189
new DateTime(2023, 12, 31, 14, 0, 0)
184190
};
191+
185192
mixedObjects.ChangeTimeZone(0, 2); // Modifies list with converted DateTime objects
186193
187194
// Process large collections with automatic parallel processing
@@ -197,9 +204,11 @@ var mixedValidInvalid = new object?[]
197204
"not a date",
198205
null
199206
};
207+
200208
var safeResults = mixedValidInvalid.GetWeekOfYears<int?>()?.ToArray(); // Returns [1, null, null]
201209
```
202210

211+
203212
## Performance Considerations
204213

205214
- **Parallel Processing**: For collections with more than 1000 elements, the library automatically uses parallel processing for better performance
@@ -215,10 +224,12 @@ var safeResults = mixedValidInvalid.GetWeekOfYears<int?>()?.ToArray(); // Return
215224
- **Generic Type Support**: Methods use generic type parameters to support various return types
216225
- **Null Safety**: All methods are designed to be null-safe, handling null inputs gracefully
217226
- **Partial Classes**: Uses partial classes to organize functionality by category:
227+
218228
- Core functionality (YANDateTime.cs)
219229
- Collection operations (YANDateTime.Collection.cs)
220230
- Generic operations (YANDateTime.Generic.cs)
221231
- Nullable operations (YANDateTime.Nullable.cs)
232+
222233
- **Internal Implementation**: Core implementation details are separated from the public API for better maintainability
223234

224235

lib/YANLib/YANEnumerable.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
### YANEnumerable - Collection Conversion Utility Library
22

3+
34
## Overview
45

56
`YANEnumerable` is a versatile utility library that provides extension methods for converting collections of objects to strongly-typed collections in C# applications. It offers a comprehensive set of methods for transforming generic and non-generic collections into arrays, lists, hash sets, dictionaries, lookups, and immutable collections of specific types.
67

8+
79
## Features
810

911
The library is organized into several functional categories:
@@ -15,14 +17,12 @@ The library is organized into several functional categories:
1517
- **HashSet Conversion**: Create strongly-typed hash sets from collections
1618
- **Type Parsing**: Automatically parse elements to the specified type during conversion
1719

18-
1920
### Dictionary and Lookup Conversion
2021

2122
- **Dictionary Creation**: Convert collections to dictionaries with typed keys and values
2223
- **Lookup Creation**: Transform collections into lookups with typed keys and elements
2324
- **Key/Value Selection**: Extract and convert keys and values from source elements
2425

25-
2626
### Immutable Collection Support
2727

2828
- **Immutable Arrays**: Convert collections to immutable arrays
@@ -32,7 +32,6 @@ The library is organized into several functional categories:
3232
- **Immutable Stacks/Queues**: Transform collections into immutable stacks or queues
3333
- **Immutable Sorted Collections**: Create immutable sorted sets and dictionaries
3434

35-
3635
### Collection Source Support
3736

3837
- **Generic Collections**: Convert from `IEnumerable<object?>` sources

0 commit comments

Comments
 (0)