<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 - Discussions by Santa&#39;s Envoy</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 - Discussions by Santa&#39;s Envoy</title>
		<link>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions</link>
	<language>en</language>
	<pubDate>Thu, 23 May 2013 07:33:28 GMT</pubDate>
	<lastBuildDate>Thu, 23 May 2013 07:33:28 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>0</c9:totalResults>
	<c9:pageCount>0</c9:pageCount>
	<c9:pageSize>0</c9:pageSize>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">Maddus Mattus said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">Santa's Envoy said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>I understand your logic, but I dont think it will work.</p>
<p>&nbsp;</p>
<p>For instance, you dont specify wich object to observe on. A event in itself is meaningless. It's the context of the event that provides the added value. A mouse move event is meaningless without the mouse object. So you cannot observe a mouse move event
 without an instance of a mouse.</p>
<p>&nbsp;</p>
<p>You are trying to create a static extension method for events. The static has no reference to the instance, so what is it listening to?</p>
</div></blockquote>
<p>What the extension method is supposed to do is simply return an Observable representation of the event, so you can access a richer set of functionallity. Contextual information is not lost because you can only obtain said Observable by calling the method
 on the event. The model we have available today (Observable.FromEvent&lt;&gt;) is much less intuitive (and much more verbose) than the extension method solution. Though the semantics aren't really&nbsp;my matter of interest.&nbsp;What I'm interested to know is why it can't
 be done. If it could, I'm pretty sure it would've.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/f0fc08d5a535440ba1c79deb00dbd20d#f0fc08d5a535440ba1c79deb00dbd20d</link>
		<pubDate>Sun, 04 Apr 2010 19:15:34 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/f0fc08d5a535440ba1c79deb00dbd20d#f0fc08d5a535440ba1c79deb00dbd20d</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">Maddus Mattus said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">Santa's Envoy said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>You cant make a extention method on a delegate, because a delegate is not an event.</p>
<p>&nbsp;</p>
<p>The event keyword turns the delegate into an event.</p>
<p>&nbsp;</p>
<p>Seeing as you cant write extension methods for keywords, they have made the workaround you've seen in this thread.</p>
<p>&nbsp;</p>
<p>Like Erik and his team says; This is by no means a replacement for events, it just makes it easyer to work with them.</p>
</div></blockquote>
<p>Well, you'll have to tell me, then,&nbsp;exactly how the event keyword modifies the delegate-type instance. As&nbsp;far as I'm concerned, it only encapsulates and limits access to the underlying object.&nbsp;Either way, it has already been shown[*] that it does not matter
 whether the variable has been declared with the event modifier; it will not work either way (* Code in the first post).</p>
<p>&nbsp;</p>
<p>I did not understand your point about writing extension methods for keywords. The event keyword simply tells the compiler to wrap that instance of the delegate type (in some way I do not pretend I know) and limit access to it. The underlying type of the
 object is of the type you declared the event with. Thus, it is that type I'm going to try and extend. If you do understand more about the subject, I'd love to hear it. Again, it does not appear to be the case that the event keyword is responsible for this,
 though.</p>
<p>&nbsp;</p>
<p>And for the last point: Yes, it pretty much is. I'm sure Erik wouldn't say it -&nbsp;or maybe he meant that&nbsp;the .NET Framework won't be rewritten to use Observables, or problably a combination of both - but it is obvious that that's exactly the&nbsp;idea (and understandably
 so).&nbsp; Though, as we all know, &quot;replacing events&quot; is a fairly simplistic view of Observable's concept.</p>
<p>&nbsp;</p>
<p>Cheers.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/7df4eb0c08384fe287049deb00dbd1ab#7df4eb0c08384fe287049deb00dbd1ab</link>
		<pubDate>Thu, 01 Apr 2010 23:41:49 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/7df4eb0c08384fe287049deb00dbd1ab#7df4eb0c08384fe287049deb00dbd1ab</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">Richard.Hein said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">Santa's Envoy said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>There is another overload that doesn't take a string - it's all strongly typed.&nbsp; However, what you really want is first class events, which neither C# nor VB.NET support.&nbsp; F# does, however, have first class events.&nbsp; You cannot create an extension method&nbsp;for&nbsp;an
 event, because events are not objects or structs, they do not have methods to invoke in the same way as first class objects.</p>
<p>&nbsp;</p>
<p>There are however, code generators that will do all that for you, already.</p>
</div></blockquote>
<p>Could you point me to&nbsp;some reference material over the mechanics of delegate types? Most material I dug up don't mention the specifics of delegates, nor a comparison of first class events and regular delegates. Thanks.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/66520f7d84474377809f9deb00dbd14e#66520f7d84474377809f9deb00dbd14e</link>
		<pubDate>Sat, 27 Mar 2010 20:57:01 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/66520f7d84474377809f9deb00dbd14e#66520f7d84474377809f9deb00dbd14e</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">Ion Todirel said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">Santa's Envoy said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>Elaborate on what? You can't &quot;auto-detect&quot; what a user does, intended to do, or the world is like. You could probably mark a collection / property or events with special attributes and tight on them in the extension method, but it's not universal, and it
 would be pretty hard to make it all thread safe&nbsp;without&nbsp;adjusting&nbsp;the original implementation. If you have a sample which works well in all possible cases, is thread safe and looks nice, I may suggest it to the CLR team for future&nbsp;considerations.</p>
</div></blockquote>
<p>I asked you to elaborate on your post because I believe you did not get the point of the thread.&nbsp;What I'm asking, in a nutshel,&nbsp;is why I can't create a generic method (as in an extension method) which could convert
<em>any</em>&nbsp;events (delegate types) into Observables. According to Richard, it lies on the mechanics of delegate types. Although the specifics are yet quite unclear, I believe that is a logical path of reasoning.</p>
<p>&nbsp;</p>
<p>Cheers.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/2fb3892c6ae54f5b97849deb00dbd121#2fb3892c6ae54f5b97849deb00dbd121</link>
		<pubDate>Sat, 27 Mar 2010 20:40:12 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/2fb3892c6ae54f5b97849deb00dbd121#2fb3892c6ae54f5b97849deb00dbd121</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">Richard.Hein said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">Santa's Envoy said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>There is another overload that doesn't take a string - it's all strongly typed.&nbsp; However, what you really want is first class events, which neither C# nor VB.NET support.&nbsp; F# does, however, have first class events.&nbsp; You cannot create an extension method&nbsp;for&nbsp;an
 event, because events are not objects or structs, they do not have methods to invoke in the same way as first class objects.</p>
<p>&nbsp;</p>
<p>There are however, code generators that will do all that for you, already.</p>
</div></blockquote>
<p>Hmm. Interesting.&nbsp;&nbsp;Would you mind elaborating on that? That is&nbsp;exactly what I want to know.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/95a66519090542f6b65a9deb00dbd09c#95a66519090542f6b65a9deb00dbd09c</link>
		<pubDate>Fri, 19 Mar 2010 04:09:36 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/95a66519090542f6b65a9deb00dbd09c#95a66519090542f6b65a9deb00dbd09c</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">TommyCarlier said:</div><div class="quoteText">
<p>You mean something like this?</p>
<p></p>
<pre class="brush: csharp">var mouseDown = Observable.FromEvent&lt;MouseButtonEventArgs&gt;(control, &quot;MouseDown&quot;);</pre>
<p></p>
<p>See Wes Dyer's <a href="http://blogs.msdn.com/wesdyer/archive/2009/11/18/a-brief-introduction-to-the-reactive-extensions-for-net-rx.aspx">
Brief Introduction to the Reactive Extensions for .NET</a>.</p>
</div></blockquote>
<p>Nope. That is the current solution we have today. What I'd like to know is why don't we have something similar to the code I posted - a clean generic function callable in any EventHandler type to get an Observable.</p>
<p>&nbsp;</p>
<p>Heck, I could&nbsp;dig a whole lot deeper on features missing for Observables, but I'm particularly interested in this specific one.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/937be52c22214a128b3d9deb00dbd040#937be52c22214a128b3d9deb00dbd040</link>
		<pubDate>Sun, 14 Mar 2010 23:41:09 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/937be52c22214a128b3d9deb00dbd040#937be52c22214a128b3d9deb00dbd040</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">Ion Todirel said:</div><div class="quoteText">
<blockquote>
<div class="quoteUser">Santa's Envoy said:</div>
<div class="quoteText">*snip*</div>
</blockquote>
<p>There isn't &nbsp;a way of doing it. Or it would be coupled.</p>
</div></blockquote>
<p>Would you elaborate on that? The whole question <em>is</em> the decoupling which we don't have. We have to provide boilerplate code for every event/delegate we transform into observables, or worse: we might have to reflect on the event's name, which further
 couples the conversion.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/0be88b4a18914b84949b9deb00dbd013#0be88b4a18914b84949b9deb00dbd013</link>
		<pubDate>Sun, 14 Mar 2010 23:38:00 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/0be88b4a18914b84949b9deb00dbd013#0be88b4a18914b84949b9deb00dbd013</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">JoshRoss said:</div><div class="quoteText">
<p>I remember seeing something about turning mousemove events into observables. &nbsp;Does any one remember that?</p>
<p>&nbsp;</p>
<p>EDIT: Something like <a href="http://mnajder.blogspot.com/2009/08/generating-observable-events-with-t4.html">
this</a>?</p>
</div></blockquote>
<p>Yeah, but that's&nbsp;extremelly coupled not only to the event itself, but to its name. The approach I'm looking for is a completelly generic way to convert any delegate type into an Observable - not only a specific event or an event with a specific name.</p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/febebdfa7a544e6f8aa89deb00dbcf65#febebdfa7a544e6f8aa89deb00dbcf65</link>
		<pubDate>Sun, 14 Mar 2010 03:37:08 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/febebdfa7a544e6f8aa89deb00dbcf65#febebdfa7a544e6f8aa89deb00dbcf65</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - AsObservable Extension Method</title>
		<description><![CDATA[<p>Why isn't there a generic,&nbsp;extension method for delegate types&nbsp;able to&nbsp;transform them (events or not) into Observables? Is it because of some limitation they've (Microsoft) imposed over events or delegate types? Is it because of something about delegate
 types themselves? I&nbsp;did write some code (pastebin link below) to test it out and, unsurprisingly, it did not work; nor with events, nor with regular delegate type variables. Take a quick look at the code and you'll understand it all.</p>
<p>&nbsp;</p>
<p><a href="http://pastebin.com/3ugP7SKW">http://pastebin.com/3ugP7SKW</a><a href="http://pastebin.com/XnLRhq7H"></a></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/537011#537011</link>
		<pubDate>Sat, 13 Mar 2010 20:23:43 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/537011-AsObservable-Extension-Method/537011#537011</guid>
		<dc:creator>Rafael de Lima Reis</dc:creator>
		<slash:comments>20</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Santa's Envoy/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>