You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Interop/InteropExtensions.cs

28 lines
707 B

using Connected.Notifications;
namespace Connected.Interop;
public static class InteropExtensions
{
public static TArgs AsArguments<TArgs>(this IDto args) where TArgs : IDto
{
var instance = typeof(TArgs).CreateInstance<TArgs>();
return Serializer.Merge(instance, args);
}
public static TArgs AsArguments<TArgs>(this IDto args, params object[] sources) where TArgs : IDto
{
var instance = typeof(TArgs).CreateInstance<TArgs>();
return Serializer.Merge(instance, sources.ToArray(), args);
}
public static TArgs AsEventArguments<TArgs>(this IDto args) where TArgs : IEventArgs
{
var instance = typeof(TArgs).CreateInstance<TArgs>();
return Serializer.Merge(instance, args);
}
}