저는 Reactive Extension 초보자입니다. Gideon Engelberth는 내 질문에 Reactive Extension에 대한 훌륭한 답을주었습니다.IObservable 할당 방법 <Unit> XDocument 인스턴스에 대한 반환 값
How to convert img url to BASE64 string in HTML on one method chain by using LINQ or Rx
지금 나는하여 XDocument 인스턴스에 IObservable 반환 값을 할당하는 방법이 두 번째 질문이 있습니다.
기드온이 저에게 벨로우즈 샘플을주었습니다.
public IObservable<Unit> ReplaceImageLinks(XDocument document)
{
return (from element in GetImages(document)
let address = new Uri(element.Attribute("src").Value)
select (from data in DownloadAsync(address)
select Convert.ToBase64String(data)
).Do(base64 => element.Attribute("src").Value = base64)
).Merge()
.IgnoreElements()
.Select(s => Unit.Default);
}
저는 이렇게하고 싶습니다. 버드 힘들 것 같습니다 ...
public void Convert(XDocument input, out XDocument output)
{
output = ReplaceImageLinks(input);
}