https://github.com/rcarubbi/carubbi.extensions
A simple library extension-method based to common tasks
https://github.com/rcarubbi/carubbi.extensions
extension-methods
Last synced: 8 months ago
JSON representation
A simple library extension-method based to common tasks
- Host: GitHub
- URL: https://github.com/rcarubbi/carubbi.extensions
- Owner: rcarubbi
- Created: 2018-08-20T16:58:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-05T15:50:48.000Z (over 7 years ago)
- Last Synced: 2025-06-27T10:06:42.419Z (about 1 year ago)
- Topics: extension-methods
- Language: C#
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Carubbi.Extensions
A simple library extension-method based to common tasks
* Datatype conversions:
Rather than
```csharp
int? intVariable;
try
{
intVariable = Convert.ToInt32(str);
}
catch(Exception ex)
{
intVariable = defaultValue;
}
```
or
```csharp
if (!int.TryParse(str, out int intValue))
{
intValue = defaultValue;
}
```
You just use
```csharp
int? intVariable = str.To(defaultValue);
```