Skip to content

Instantly share code, notes, and snippets.

public static class DateTimeExtentions
{
public static string ToDateTimeHighPrecision(this DateTime source)
{
return source.ToString("MM/dd/yyyy h:mm:ss.fff tt");
}
}
[HttpGet("GetAllCommandHandlers")]
public async Task<IEnumerable<string>> GetAllCommandHandlers()
{
var genericType = typeof(ICommandHandler<>);
var types = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())
.Where(t => t.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition().Equals(genericType)))
.Select(x => $"{x.FullName}.{x.Name}").ToList();
var genericTypeWithResult = typeof(ICommandHandler<,>);
var typesWithresult = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())