Added TranslatorBase for Translate()
This commit is contained in:
parent
d79dced4b3
commit
595899cd2a
|
@ -5,6 +5,7 @@
|
|||
<ProjectReference Include="..\src\Publishers\Publishers.csproj" />
|
||||
<ProjectReference Include="..\src\Subscriptions\Subscriptions.csproj" />
|
||||
<ProjectReference Include="..\src\Translating\Translating.csproj" />
|
||||
<ProjectReference Include="..\src\Filtering\Filtering.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<metadata>
|
||||
<id>ProSol.Messaging</id>
|
||||
<title>ProSol.Messaging</title>
|
||||
<version>4.0.0-rc.6.0</version>
|
||||
<version>4.0.0-rc.7.2</version>
|
||||
<authors>Alex Kozachenko</authors>
|
||||
<owners>Alex Kozachenko</owners>
|
||||
<projectUrl> https://git.disroot.org/alexenko/ProSol.Messaging </projectUrl>
|
||||
|
|
|
@ -4,10 +4,14 @@ public static class IPublisherFluentExtensions
|
|||
{
|
||||
public static IPublisher Translate<TSource, TDest>(
|
||||
this IPublisher publisher,
|
||||
Func<TSource, TDest> converter)
|
||||
Func<TSource, TDest> converter)
|
||||
=> Translate(publisher, new SimpleTranslator<TSource, TDest>(converter));
|
||||
|
||||
public static IPublisher Translate<TSource, TDest>(
|
||||
this IPublisher publisher,
|
||||
TranslatorBase<TSource, TDest> translatorBase)
|
||||
{
|
||||
var result = new SimpleTranslator<TSource, TDest>(converter);
|
||||
var unsubscriber = publisher.Subscribe(result);
|
||||
return result;
|
||||
var unsubscriber = publisher.Subscribe(translatorBase);
|
||||
return translatorBase;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue