diff --git a/.gitignore b/.gitignore
index 53eb76f..a577d5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@ bld/
# Visual Studio 2015/2017 cache/options directory
.vs/
+
# Visual Studio Code
.vscode/
@@ -130,6 +131,9 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
+# JustCode is a .NET coding add-in
+.JustCode
+
# TeamCity is a build add-in
_TeamCity*
@@ -264,9 +268,7 @@ ServiceFabricBackup/
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
-*- [Bb]ackup.rdl
-*- [Bb]ackup ([0-9]).rdl
-*- [Bb]ackup ([0-9][0-9]).rdl
+*- [Bb]ackup*.rdl
# Microsoft Fakes
FakesAssemblies/
@@ -349,5 +351,81 @@ healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
-# Ionide (cross platform F# VS Code tools) working folder
-.ionide/
+
+## Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+## Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# AWS User-specific
+.idea/**/aws.xml
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# SonarLint plugin
+.idea/sonarlint/
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
\ No newline at end of file
diff --git a/code/ConsoleApp1/App.config b/code/ConsoleApp1/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/code/ConsoleApp1/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/code/ConsoleApp1/ConsoleApp1.csproj b/code/ConsoleApp1/ConsoleApp1.csproj
new file mode 100644
index 0000000..a1d8db1
--- /dev/null
+++ b/code/ConsoleApp1/ConsoleApp1.csproj
@@ -0,0 +1,59 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {3D172543-0DA6-4D77-903A-08FBE4CD9A9F}
+ Exe
+ ConsoleApp1
+ ConsoleApp1
+ v4.7.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {648a37c2-2150-431d-ae9c-902adf96f5a3}
+ WouldLike.Extensions.NetFramework.40
+
+
+
+
\ No newline at end of file
diff --git a/code/ConsoleApp1/Program.cs b/code/ConsoleApp1/Program.cs
new file mode 100644
index 0000000..dae552b
--- /dev/null
+++ b/code/ConsoleApp1/Program.cs
@@ -0,0 +1,27 @@
+using System;
+using WouldLike.Extensions;
+using WouldLike.Extensions.String;
+
+namespace ConsoleApp1
+{
+ internal class Program
+ {
+ static void Main(string[] args)
+ {
+ var program = new Program();
+ program.Run();
+
+ Console.WriteLine("Press any key to continue...");
+ Console.ReadKey();
+ }
+
+ private void Run()
+ {
+ var myAmazingString = "This is an amazing string";
+ Console.WriteLine($"Before: {myAmazingString}");
+ var after = myAmazingString.Truncate(7);
+
+ Console.WriteLine($"After: {after}");
+ }
+ }
+}
diff --git a/code/ConsoleApp1/Properties/AssemblyInfo.cs b/code/ConsoleApp1/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..65fff3a
--- /dev/null
+++ b/code/ConsoleApp1/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ConsoleApp1")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HP Inc.")]
+[assembly: AssemblyProduct("ConsoleApp1")]
+[assembly: AssemblyCopyright("Copyright © HP Inc. 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3d172543-0da6-4d77-903a-08fbe4cd9a9f")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/code/WouldLike.Extensions.sln b/code/WouldLike.Extensions.sln
index fa3a527..c66e0de 100644
--- a/code/WouldLike.Extensions.sln
+++ b/code/WouldLike.Extensions.sln
@@ -23,6 +23,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "WouldLike.Extensions.Tests"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WouldLike.Extensions.NetFramework.40.Tests", "tests\WouldLike.Extensions.NetFramework.40.Tests\WouldLike.Extensions.NetFramework.40.Tests.csproj", "{73BF1EC9-F44E-4948-9AFB-EA5D3AAAA0DA}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{3D172543-0DA6-4D77-903A-08FBE4CD9A9F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -45,6 +47,10 @@ Global
{73BF1EC9-F44E-4948-9AFB-EA5D3AAAA0DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73BF1EC9-F44E-4948-9AFB-EA5D3AAAA0DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73BF1EC9-F44E-4948-9AFB-EA5D3AAAA0DA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3D172543-0DA6-4D77-903A-08FBE4CD9A9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3D172543-0DA6-4D77-903A-08FBE4CD9A9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3D172543-0DA6-4D77-903A-08FBE4CD9A9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3D172543-0DA6-4D77-903A-08FBE4CD9A9F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/code/sources/WouldLike.Extensions.NetFramework.40/WouldLike.Extensions.NetFramework.40.csproj b/code/sources/WouldLike.Extensions.NetFramework.40/WouldLike.Extensions.NetFramework.40.csproj
index 32f00a7..16c3dc2 100644
--- a/code/sources/WouldLike.Extensions.NetFramework.40/WouldLike.Extensions.NetFramework.40.csproj
+++ b/code/sources/WouldLike.Extensions.NetFramework.40/WouldLike.Extensions.NetFramework.40.csproj
@@ -9,7 +9,7 @@
Properties
WouldLike.Extensions.NetFramework
WouldLike.Extensions.NetFramework.40
- v4.8
+ v4.7.2
512
true
@@ -36,11 +36,10 @@
-
-
-
-
-
+
+ False
+ ..\..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.29\System.Text.Json.dll
+
diff --git a/code/sources/WouldLike.Extensions/JsonConverterExtensions.cs b/code/sources/WouldLike.Extensions/JsonConverterExtensions.cs
new file mode 100644
index 0000000..7c7de36
--- /dev/null
+++ b/code/sources/WouldLike.Extensions/JsonConverterExtensions.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace WouldLike.Extensions
+{
+ internal static class JsonConverterExtensions
+ {
+ public static bool TryDeserialize(this JsonConverter jsonConverter, Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, out T value)
+ {
+ try
+ {
+ value = jsonConverter.Read(ref reader, typeToConvert, options);
+ }
+ catch (Exception)
+ {
+ value = default;
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/code/sources/WouldLike.Extensions/StringExtensions.cs b/code/sources/WouldLike.Extensions/StringExtensions.cs
index 98a8387..024779e 100644
--- a/code/sources/WouldLike.Extensions/StringExtensions.cs
+++ b/code/sources/WouldLike.Extensions/StringExtensions.cs
@@ -1,4 +1,4 @@
-namespace WouldLike.Extensions
+namespace WouldLike.Extensions.String
{
public static class StringExtensions
{
diff --git a/code/sources/WouldLike.Extensions/WouldLike.Extensions.projitems b/code/sources/WouldLike.Extensions/WouldLike.Extensions.projitems
index 6909e18..b7fe572 100644
--- a/code/sources/WouldLike.Extensions/WouldLike.Extensions.projitems
+++ b/code/sources/WouldLike.Extensions/WouldLike.Extensions.projitems
@@ -9,6 +9,7 @@
WouldLike.Extensions
+
diff --git a/code/tests/WouldLike.Extensions.NetFramework.40.Tests/packages.config b/code/tests/WouldLike.Extensions.NetFramework.40.Tests/packages.config
index 9cf0195..5e1f70d 100644
--- a/code/tests/WouldLike.Extensions.NetFramework.40.Tests/packages.config
+++ b/code/tests/WouldLike.Extensions.NetFramework.40.Tests/packages.config
@@ -1,7 +1,6 @@
-
diff --git a/code/tests/WouldLike.Extensions.Tests/StringExtensionTests.cs b/code/tests/WouldLike.Extensions.Tests/StringExtensionsTests.cs
similarity index 69%
rename from code/tests/WouldLike.Extensions.Tests/StringExtensionTests.cs
rename to code/tests/WouldLike.Extensions.Tests/StringExtensionsTests.cs
index 5ebc143..0f79084 100644
--- a/code/tests/WouldLike.Extensions.Tests/StringExtensionTests.cs
+++ b/code/tests/WouldLike.Extensions.Tests/StringExtensionsTests.cs
@@ -1,20 +1,21 @@
using NUnit.Framework;
using NFluent;
+using WouldLike.Extensions.String;
namespace WouldLike.Extensions.Tests
{
[TestFixture]
- public class StringExtensionTests
+ public class StringExtensionsTests
{
[Test]
public void ShouldTruncateWhenStringIsLongerThanExpectedLength()
{
const string input = "This is a sample";
const string expected = "This is a ";
- const int expectedLenght = 10;
- var result = input.Truncate(expectedLenght);
+ const int expectedLength = 10;
+ var result = input.Truncate(expectedLength);
Check.That(result).IsEqualTo(expected);
- Check.That(result.Length).IsEqualTo(expectedLenght);
+ Check.That(result.Length).IsEqualTo(expectedLength);
}
@@ -23,9 +24,9 @@ public void ShouldNotTruncateWhenStringIsSmallerThanExpectedLength()
{
const string input = "This is a sample";
const string expected = "This is a sample";
- const int expectedLenght = 200;
+ const int expectedLength = 200;
var initialLenght = input.Length;
- var result = input.Truncate(expectedLenght);
+ var result = input.Truncate(expectedLength);
Check.That(result).IsEqualTo(expected);
Check.That(result.Length).IsEqualTo(initialLenght);
}
diff --git a/code/tests/WouldLike.Extensions.Tests/WouldLike.Extensions.Tests.projitems b/code/tests/WouldLike.Extensions.Tests/WouldLike.Extensions.Tests.projitems
index 1e2c5e6..98447ef 100644
--- a/code/tests/WouldLike.Extensions.Tests/WouldLike.Extensions.Tests.projitems
+++ b/code/tests/WouldLike.Extensions.Tests/WouldLike.Extensions.Tests.projitems
@@ -10,6 +10,6 @@
-
+
\ No newline at end of file