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
+---------------------+---------------------+---------------------+ | |
| Test-Wert | SMALLDATETIME | DATETIME | | |
+---------------------+---------------------+---------------------+ | |
| 09.04.2021 23:59:00 | 09/04/2021 23:59:00 | 09/04/2021 23:59:00 | | |
| 09.04.2021 23:59:01 | 09/04/2021 23:59:00 | 09/04/2021 23:59:01 | | |
| 09.04.2021 23:59:02 | 09/04/2021 23:59:00 | 09/04/2021 23:59:02 | | |
| 09.04.2021 23:59:03 | 09/04/2021 23:59:00 | 09/04/2021 23:59:03 | | |
| 09.04.2021 23:59:04 | 09/04/2021 23:59:00 | 09/04/2021 23:59:04 | | |
| 09.04.2021 23:59:05 | 09/04/2021 23:59:00 | 09/04/2021 23:59:05 | | |
| 09.04.2021 23:59:06 | 09/04/2021 23:59:00 | 09/04/2021 23:59:06 | |
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
// Method to check if the given object is a list | |
bool IsList(object value) | |
{ | |
return value is IList && value.GetType().IsGenericType && value.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(List<>))); | |
} | |
// Some object | |
object value = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; | |
if (IsList(value)) |
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
/// <summary> | |
/// Provides the main class for the view models | |
/// </summary> | |
internal class ViewModelBase : ObservableObject | |
{ | |
/// <summary> | |
/// The instance of the mah apps dialog coordinator | |
/// </summary> | |
private readonly IDialogCoordinator _dialogCoordinator; |
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
// Works with .NET Framework, .NET Core and .NET Standard | |
using System; | |
using System.Runtime.InteropServices; | |
using System.Security; | |
/// <summary> | |
/// Provides several function to interact with a <see cref="SecureString"/> | |
/// </summary> | |
public static class SecureStringExtension | |
{ |
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
public class InfoMetadataModule : MetadataBase<InfoModule> { } |
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
public class MetadataBase<TModule> : MetadataModule<CustomMetadata> where TModule : class | |
{ | |
protected MetadataBase() | |
{ | |
AddDescription(); | |
} | |
private void AddDescription() | |
{ | |
var metaData = GetCustomMetadata<TModule, RouteDescriptionAttribute>(); |
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
public class InfoMetadataModule : MetadataModule<CustomMetadata> | |
{ | |
public InfoMetadataModule() | |
{ | |
var metaData = GetCustomMetadata(); | |
foreach (var entry in metaData) | |
{ | |
Describe[entry.Name] = x => new CustomMetadata(x, entry.Description); | |
} |
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
public sealed class InfoModule : NancyModule | |
{ | |
[RouteDescription("HelloRoute", "Returns a simple hello message.")] | |
[RouteDescription("InfoRoute", "Returns the current date time and a short hello message.")] | |
public InfoModule() | |
{ | |
Get("/", _ => Response.AsText("Hello from Nancy!", name: "HelloRoute"); | |
Get("/info", _ => | |
{ |
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
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = true)] | |
public class RouteDescriptionAttribute : Attribute | |
{ | |
public string Name { get; } | |
public string Description { get; } | |
public RouteDescriptionAttribute(string name, string description) | |
{ | |
Name = name; | |
Description = description; |
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
public static List<int> GetGaps(List<int> originalList) | |
{ | |
// Check if the list is empty | |
if (originalList == null) | |
return new List<int>(); | |
// Order the list | |
originalList = originalList.OrderBy(o => o).ToList(); | |
// Get the first element |
NewerOlder