-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
144b9e4
commit 665136a
Showing
8 changed files
with
53 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Lanceur.Core.Models | ||
{ | ||
public abstract class MacroQueryResult : SelfExecutableQueryResult | ||
{ | ||
#region Methods | ||
|
||
public abstract SelfExecutableQueryResult Clone(); | ||
|
||
#endregion Methods | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Text.Json; | ||
|
||
namespace Lanceur.SharedKernel.Mixins; | ||
|
||
public static class CloningMixin | ||
{ | ||
#region Methods | ||
|
||
/// <summary> | ||
/// Clone object by serialising/deserialising it | ||
/// </summary> | ||
/// <param name="obj">The object to clone</param> | ||
/// <typeparam name="T">The type of the object to clone</typeparam> | ||
/// <returns>A new instance of the object with the same state</returns> | ||
public static T CloneObject<T>(this T obj) | ||
where T: new() | ||
{ | ||
var bytes = JsonSerializer.SerializeToUtf8Bytes(obj); | ||
return JsonSerializer.Deserialize<T>(bytes); | ||
} | ||
|
||
#endregion Methods | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/Tests/Lanceur.Tests/Utils/ReservedAliases/ExecutableWithResultsTestAlias.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters