<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog de Nico-pyright(c) &#187; C#</title>
	<atom:link href="https://blog.developpez.com/nico-pyright/pcategory/c/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/nico-pyright</link>
	<description></description>
	<lastBuildDate>Mon, 08 Apr 2013 09:26:35 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>MVP Visual C# pour 2013</title>
		<link>https://blog.developpez.com/nico-pyright/p11626/c/mvp-visual-c-pour-2013</link>
		<comments>https://blog.developpez.com/nico-pyright/p11626/c/mvp-visual-c-pour-2013#comments</comments>
		<pubDate>Thu, 03 Jan 2013 09:06:02 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/nico-pyright/?p=133</guid>
		<description><![CDATA[J&#8217;ai le plaisir d&#8217;être renouvelé MVP encore une année, et comme l&#8217;année dernière pour la catégorie Visual C#. Merci à Microsoft de me renouveler une septième fois sa confiance et c&#8217;est toujours avec plaisir que j&#8217;apprécie partager mes aventures .NET avec vous. J&#8217;en profite pour vous souhaiter une très bonne année, en espérant que vous avez eu plein de Windows Phone 8 sous le sapin]]></description>
				<content:encoded><![CDATA[<p>J&rsquo;ai le plaisir d&rsquo;être renouvelé MVP encore une année, et comme l&rsquo;année dernière pour la catégorie Visual C#.</p>
<p>Merci à Microsoft de me renouveler une septième fois sa confiance et c&rsquo;est toujours avec plaisir que j&rsquo;apprécie partager mes aventures .NET avec vous.</p>
<p>J&rsquo;en profite pour vous souhaiter une très bonne année, en espérant que vous avez eu plein de Windows Phone 8 sous le sapin <img src="https://blog.developpez.com/nico-pyright/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sortie de mon livre : Apprenez à développer en C# &#8211; La programmation C# .Net expliquée aux débutants</title>
		<link>https://blog.developpez.com/nico-pyright/p10921/c/sortie_de_mon_livre_apprenez_a_developpe</link>
		<comments>https://blog.developpez.com/nico-pyright/p10921/c/sortie_de_mon_livre_apprenez_a_developpe#comments</comments>
		<pubDate>Thu, 05 Apr 2012 12:37:53 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Livres]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Bonjour, j&#8217;ai le plaisir de vous annoncer la sortie de mon livre, que j&#8217;ai écrit en partenariat avec le site du zéro. Il s&#8217;agit d&#8217;un livre permettant d&#8217;apprendre le C#. Il est orienté débutant dans la mesure où vous avez juste besoin de savoir allumer un PC pour le suivre. Au menu : Qu’est-ce que la programmation ? Quel langage choisir ? Pourquoi C# ? Installez Visual C# 2010 Express (gratuitement) et écrivez votre premier [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Bonjour,</p>
<p>j&rsquo;ai le plaisir de vous annoncer la sortie de mon livre, que j&rsquo;ai écrit en partenariat avec le site du zéro.</p>
<p><img src="http://ecx.images-amazon.com/images/I/413C2%2B6PfJL._SL500_AA300_.jpg" alt="Apprendre le C#" title="Livre C#" /></p>
<p>Il s&rsquo;agit d&rsquo;un livre permettant d&rsquo;apprendre le C#. Il est orienté débutant dans la mesure où vous avez juste besoin de savoir allumer un PC pour le suivre.</p>
<p>Au menu :</p>
<ul>
<li>Qu’est-ce que la programmation ? Quel langage choisir ? Pourquoi C# ?</li>
<li>Installez Visual C# 2010 Express (gratuitement) et écrivez votre premier programme</li>
<li>Apprenez à manipuler les variables, les méthodes, les boucles…</li>
<li>Initiez-vous aux concepts de la programmation orientée objet</li>
<li>Pratiquez grâce aux TP : créez un jeu, une application de gestion bancaire, un simulateur de météo…</li>
<li>Connectez-vous aux bases de données avec Entity Framework</li>
<li>Découvrez les applications que l&rsquo;on peut développer en C#</li>
</ul>
<p>Bref, plein de petites choses dans un style où on ne se prend pas la tête, pour vous permettre de démarrer dans l&rsquo;apprentissage du C#, et tout en couleur !!</p>
<p><a href="http://www.amazon.fr/Apprenez-d%C3%A9velopper-programmation-expliqu%C3%A9e-d%C3%A9butants/dp/2953527869/">Voir le livre sur Amazon</a></p>
<p><img src="http://uploads.siteduzero.com/files/365001_366000/365357.jpg" alt="Dos du livre C#" title="Dos du livre apprendre le C#" width="300px" /></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVP Visual C# pour 2012</title>
		<link>https://blog.developpez.com/nico-pyright/p10627/c/mvp_visual_c_pour_2012</link>
		<comments>https://blog.developpez.com/nico-pyright/p10627/c/mvp_visual_c_pour_2012#comments</comments>
		<pubDate>Tue, 03 Jan 2012 20:55:19 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Après avoir été nominé MVP Visual C++ en 2007, puis MVP ASP.NET en 2010, me voilà désormais MVP Visual C# pour 2012. Je reconnais que ce blog est de moins en moins mis à jour mais je vais essayer de me rattraper Merci encore à Microsoft de me renouveler sa confiance. J&#8217;en profite au passage pour vous souhaitez à tous une bonne année, pleine de C# et de .NET.]]></description>
				<content:encoded><![CDATA[<p>Après avoir été nominé MVP Visual C++ en 2007, puis MVP ASP.NET en 2010, me voilà désormais MVP Visual C# pour 2012.</p>
<p>Je reconnais que ce blog est de moins en moins mis à jour mais je vais essayer de me rattraper <img src="https://blog.developpez.com/nico-pyright/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /></p>
<p>Merci encore à Microsoft de me renouveler sa confiance. J&rsquo;en profite au passage pour vous souhaitez à tous une bonne année, pleine de C# et de .NET.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tutoriel : naviguer entre les pages de vos applications Silverlight pour Windows Phone 7</title>
		<link>https://blog.developpez.com/nico-pyright/p9580/c/tutoriel_naviguer_entre_les_pages_de_vos_7</link>
		<comments>https://blog.developpez.com/nico-pyright/p9580/c/tutoriel_naviguer_entre_les_pages_de_vos_7#comments</comments>
		<pubDate>Tue, 14 Dec 2010 23:00:00 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Windows Phone 7 (WP7) est la nouvelle plateforme de développement de Microsoft destinée aux smartphones. Dans un premier tutoriel, nous avons pu voir une introduction au développement WP7. Dans le second, nous avons pu voir comment utiliser la ListBox et l&#8217;Isolated Storage. Dans le troisième, vous avez pu découvrir comment utiliser le contrôle pivot, son système de swipe et comment accéder à des ressources sur le net. Dans celui-ci, nous allons voir comment naviguer entre [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Windows Phone 7 (WP7) est la nouvelle plateforme de développement de Microsoft destinée aux smartphones.</p>
<p>Dans un premier tutoriel, nous avons <a href="http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/introduction-developpement-windows-phone-seven-wp7-silverlight/">pu voir une introduction au développement WP7</a>.<br />
Dans le second, nous avons pu voir <a href="http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/listbox-isolated-storage-wp7-silverlight/">comment utiliser la ListBox et l&rsquo;Isolated Storage</a>.<br />
Dans le troisième, vous avez <a href="http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/web-service-control-pivot-wp7-silverlight/">pu découvrir comment utiliser le contrôle pivot, son système de swipe et comment accéder à des ressources sur le net</a>.</p>
<p>Dans celui-ci, nous allons voir comment naviguer entre les pages d&rsquo;une application Silverlight pour Windows Phone 7. Nous verrons également que le bouton &laquo;&nbsp;Back&nbsp;&raquo; du téléphone s&rsquo;interface parfaitement avec le framework de navigation de Silverlight pour WP7. Nous verrons enfin comment faire passer des informations entre les pages. </p>
<p>http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/navigation-silverlight-wp7/</p>
<p>Bonne lecture</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutoriel : appeler des services web et utiliser le contrôle Pivot dans vos applications Windows Phone 7</title>
		<link>https://blog.developpez.com/nico-pyright/p9545/c/tutoriel_appeler_des_services_web_et_uti_7</link>
		<comments>https://blog.developpez.com/nico-pyright/p9545/c/tutoriel_appeler_des_services_web_et_uti_7#comments</comments>
		<pubDate>Tue, 30 Nov 2010 23:00:00 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Windows Phone 7 (WP7) est la nouvelle plateforme de développement de Microsoft destinée aux smartphones. Dans un premier tutoriel, nous avons pu voir une introduction au développement WP7. Dans le second, nous avons pu voir comment utiliser la ListBox et l&#8217;Isolated Storage. Dans celui-ci, à travers la création d&#8217;une application de météo, vous découvrirez comment faire appel à des ressources sur le web. Vous verrez également comment utiliser le contrôle Pivot, un des contrôles les [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Windows Phone 7 (WP7) est la nouvelle plateforme de développement de Microsoft destinée aux smartphones.</p>
<p>Dans un premier tutoriel, nous avons <a href="http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/introduction-developpement-windows-phone-seven-wp7-silverlight/">pu voir une introduction au développement WP7</a>.<br />
Dans le second, nous avons pu voir <a href="http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/listbox-isolated-storage-wp7-silverlight/">comment utiliser la ListBox et l&rsquo;Isolated Storage</a>.</p>
<p>Dans celui-ci, à travers la création d&rsquo;une application de météo, vous découvrirez comment faire appel à des ressources sur le web. Vous verrez également comment utiliser le contrôle Pivot, un des contrôles les plus importants lors du développement d&rsquo;applications pour Windows Phone 7. Il permet de gérer facilement la navigation horizontale, avec ce qu&rsquo;on appelle le swipe et qui permet de simuler un comportement où l&rsquo;utilisateur pose son doigt sur l&rsquo;écran et le fait glisser vers la droite ou la gauche, comme s&rsquo;il tournait une page.</p>
<p>http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/web-service-control-pivot-wp7-silverlight/</p>
<p>Bonne lecture</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutoriel : Utiliser la ListBox et l&#8217;Isolated Storage dans vos applications Windows Phone 7 avec Silverlight</title>
		<link>https://blog.developpez.com/nico-pyright/p9526/c/tutoriel_utiliser_la_listbox_et_l_isolat</link>
		<comments>https://blog.developpez.com/nico-pyright/p9526/c/tutoriel_utiliser_la_listbox_et_l_isolat#comments</comments>
		<pubDate>Mon, 22 Nov 2010 23:00:00 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Windows Phone 7 (WP7) est la nouvelle plateforme de développement de Microsoft destinée aux smartphones. Dans un premier tutoriel, nous avons pu voir une introduction au développement WP7. Dans ce deuxième tutoriel, vous découvrirez la puissance du contrôle ListBox WP7 et comment il s&#8217;adapte au développement sur téléphone. Vous verrez aussi comment traiter des événements simples, comme un click sur un bouton par exemple. Vous verrez enfin comment faire persister de l&#8217;information entre les différents [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Windows Phone 7 (WP7) est la nouvelle plateforme de développement de Microsoft destinée aux smartphones.</p>
<p>Dans un premier tutoriel, <a href="http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/introduction-developpement-windows-phone-seven-wp7-silverlight/">nous avons pu voir une introduction au développement WP7</a>.</p>
<p>Dans ce deuxième tutoriel, vous découvrirez la puissance du contrôle ListBox WP7 et comment il s&rsquo;adapte au développement sur téléphone.<br />
Vous verrez aussi comment traiter des événements simples, comme un click sur un bouton par exemple.<br />
Vous verrez enfin comment faire persister de l&rsquo;information entre les différents démarrages du téléphone et lorsque l&rsquo;application est suspendue.</p>
<p>http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/listbox-isolated-storage-wp7-silverlight/</p>
<p>Bonne lecture</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tutoriel : introduction au développement d&#8217;applications Windows Phone 7</title>
		<link>https://blog.developpez.com/nico-pyright/p9484/c/tutoriel_introduction_au_developpement_d_7</link>
		<comments>https://blog.developpez.com/nico-pyright/p9484/c/tutoriel_introduction_au_developpement_d_7#comments</comments>
		<pubDate>Sun, 14 Nov 2010 23:00:00 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Windows Phone 7 (WP7) est la nouvelle plateforme de développement de Microsoft destinée aux smartphones. Dans ce premier tutoriel, vous découvrirez comment démarrer le développement d&#8217;applications avec Windows Phone 7. Nous commencerons par installer les outils nécessaires au développement sur WP7 puis nous créerons un premier programme simpliste en utilisant Silverlight pour WP7. Enfin, nous l&#8217;exécuterons sur l&#8217;émulateur et découvrirons son fonctionnement. Bonne lecture : http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/introduction-developpement-windows-phone-seven-wp7-silverlight/]]></description>
				<content:encoded><![CDATA[<p>Windows Phone 7 (WP7) est la nouvelle plateforme de développement de Microsoft destinée aux smartphones.</p>
<p>Dans ce premier tutoriel, vous découvrirez comment démarrer le développement d&rsquo;applications avec Windows Phone 7.<br />
Nous commencerons par installer les outils nécessaires au développement sur WP7 puis nous créerons un premier programme simpliste en utilisant Silverlight pour WP7.<br />
Enfin, nous l&rsquo;exécuterons sur l&rsquo;émulateur et découvrirons son fonctionnement.</p>
<p>Bonne lecture : http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/windows-phone-seven/introduction-developpement-windows-phone-seven-wp7-silverlight/</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment effectuer une traduction automatique en se servant de l&#8217;API de traduction de Bing ?</title>
		<link>https://blog.developpez.com/nico-pyright/p9026/c/comment_effectuer_une_traduction_automat</link>
		<comments>https://blog.developpez.com/nico-pyright/p9026/c/comment_effectuer_une_traduction_automat#comments</comments>
		<pubDate>Fri, 18 Jun 2010 20:05:00 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Web services]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Utiliser les API de Bing ? Rien de plus simple. Pour cet exemple, nous allons traduire le fameux &#171;&#160;Bonjour le monde&#160;&#187; dans plusieurs langues, grâce à l&#8217;API de traduction de Bing. Première étape indispensable, obtenir un AppID en s&#8217;inscrivant sur http://www.bing.com/developers/createapp.aspx. Une fois cet AppID obtenu, il ne reste plus qu&#8217;à interroger l&#8217;API. Pour la simplicité, j&#8217;ai choisi de les appeler en SOAP, mais il est possible de les interroger en JSON ou directement en [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Utiliser les API de Bing ? Rien de plus simple.</p>
<p>Pour cet exemple, nous allons traduire le fameux &laquo;&nbsp;Bonjour le monde&nbsp;&raquo; dans plusieurs langues, grâce à l&rsquo;API de traduction de Bing. </p>
<p>Première étape indispensable, obtenir un AppID en s&rsquo;inscrivant sur <a href="http://www.bing.com/developers/createapp.aspx">http://www.bing.com/developers/createapp.aspx</a>. </p>
<p>Une fois cet AppID obtenu, il ne reste plus qu&rsquo;à interroger l&rsquo;API. Pour la simplicité, j&rsquo;ai choisi de les appeler en SOAP, mais il est possible de les interroger en JSON ou directement en XML. </p>
<p>Pour ce faire, on utilise le fameux Add Service references, et on saisi l&rsquo;url : <a href="http://api.bing.net/search.wsdl?AppID=[MonAppId]&amp;Version=2.2">http://api.bing.net/search.wsdl?AppID=[MonAppId]&amp;Version=2.2</a></p>
<p>Une fois le proxy généré, il ne reste plus qu&rsquo;à utiliser le client. Pour savoir quoi mettre, rendez vous dans la documentation de l&rsquo;API : <a href="http://msdn.microsoft.com/en-us/library/dd251056.aspx">http://msdn.microsoft.com/en-us/library/dd251056.aspx</a>. Elle n&rsquo;est pas parfaite, mais en fouillant un peu, on arrive à se débrouiller et à trouver des exemples de code. </p>
<p>Ecrivons un petit programme d&rsquo;exemple qui traduit le fameux Hello World dans plusieurs langues :</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> BingPortTypeClient client = <span style="color: #0000ff">new</span> BingPortTypeClient();</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> SearchRequest request = <span style="color: #0000ff">new</span> SearchRequest</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>         AppId = <span style="color: #006080">&quot;[MonAppId]&quot;</span>,</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Sources = <span style="color: #0000ff">new</span>[] { SourceType.Translation },</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Translation = <span style="color: #0000ff">new</span> TranslationRequest { SourceLanguage = <span style="color: #006080">&quot;Fr&quot;</span> },</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Query = <span style="color: #006080">&quot;Bonjour le monde&quot;</span></pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>&#160; </pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> List&lt;<span style="color: #0000ff">string</span>&gt; codes = <span style="color: #0000ff">new</span> List&lt;<span style="color: #0000ff">string</span>&gt; { <span style="color: #006080">&quot;Fr&quot;</span>, <span style="color: #006080">&quot;En&quot;</span>, <span style="color: #006080">&quot;Ar&quot;</span>, <span style="color: #006080">&quot;Nl&quot;</span>, <span style="color: #006080">&quot;De&quot;</span>, <span style="color: #006080">&quot;It&quot;</span>, <span style="color: #006080">&quot;Pl&quot;</span>, <span style="color: #006080">&quot;Pt&quot;</span>, <span style="color: #006080">&quot;Es&quot;</span> };</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> <span style="color: #0000ff">foreach</span> (<span style="color: #0000ff">string</span> code <span style="color: #0000ff">in</span> codes)</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     request.Translation.TargetLanguage = code;</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     SearchResponse response = client.Search(request);</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     Console.WriteLine(response.Translation.Results.First().TranslatedTerm);</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> }</pre>
</div>
</div>
<p>
Voilà, c&rsquo;est terminé. C&rsquo;est plutôt simple de faire une traduction grâce aux API de Bing. </p>
<p>A noter que la liste des langues se trouve ici : <a href="http://msdn.microsoft.com/en-us/library/dd877907.aspx">http://msdn.microsoft.com/en-us/library/dd877907.aspx</a></p>
<p> </p>
<p><a href="http://blog.developpez.com/media/140/WindowsLiveWriter/Commenteffectuerunetraductionautomatique_F068/image_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.developpez.com/media/140/WindowsLiveWriter/Commenteffectuerunetraductionautomatique_F068/image_thumb.png" width="629" height="173" /></a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutoriel : Utilisez le pattern Model-View-ViewModel dans vos applications Silverlight grâce à MVVM Light toolkit</title>
		<link>https://blog.developpez.com/nico-pyright/p8982/c/tutoriel_utilisez_le_pattern_model_view_</link>
		<comments>https://blog.developpez.com/nico-pyright/p8982/c/tutoriel_utilisez_le_pattern_model_view_#comments</comments>
		<pubDate>Tue, 08 Jun 2010 12:26:11 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Je vous présente mon dernier article : Utilisez le pattern Model-View-ViewModel dans vos applications Silverlight grâce à MVVM Light toolkit Cet article constitue une introduction au développement d&#8217;applications Silverlight en utilisant le design pattern M-V-VM grâce au MVVM Light Toolkit de Laurent Bugnion. Bonne lecture]]></description>
				<content:encoded><![CDATA[<p>Je vous présente mon dernier article : <a href="http://nico-pyright.developpez.com/tutoriel/vs2010/csharp/silverlight/introduction-mvvm-toolkit-silverlight/">Utilisez le pattern Model-View-ViewModel dans vos applications Silverlight grâce à MVVM Light toolkit</a></p>
<p>Cet article constitue une introduction au développement d&rsquo;applications Silverlight en utilisant le design pattern M-V-VM grâce au MVVM Light Toolkit de Laurent Bugnion.</p>
<p>Bonne lecture</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[MEF][C#] Un petit coup d’oeil au Managed Extensibility Framework</title>
		<link>https://blog.developpez.com/nico-pyright/p8762/c/mef_c_un_petit_coup_darsquo_oeil_au_mana</link>
		<comments>https://blog.developpez.com/nico-pyright/p8762/c/mef_c_un_petit_coup_darsquo_oeil_au_mana#comments</comments>
		<pubDate>Fri, 26 Mar 2010 20:12:00 +0000</pubDate>
		<dc:creator><![CDATA[nico-pyright(c)]]></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[MEF (Managed Extensibility Framework) est un framework développé par Microsoft qui permet de créer des applications extensible facilement. Il fonctionne comme un système de plugin et est capable de composer une application en chargeant des extensions à des endroits prédéfinis. Cela permet d&#8217;étendre un logiciel sans avoir besoin de connaitre à l&#8217;avance le fonctionnement du plug-in, tant que le celui-ci respecte un contrat ; grâce à la fonctionnalité de découverte de MEF. MEF fonctionne grâce [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>MEF (Managed Extensibility Framework) est un framework développé par Microsoft qui permet de créer des applications extensible facilement.   <br />Il fonctionne comme un système de plugin et est capable de composer une application en chargeant des extensions à des endroits prédéfinis. Cela permet d&rsquo;étendre un logiciel sans avoir besoin de connaitre à l&rsquo;avance le fonctionnement du plug-in, tant que le celui-ci respecte un contrat ; grâce à la fonctionnalité de découverte de MEF. </p>
<p>MEF fonctionne grâce à des annotations et des attributs. </p>
<p>L&rsquo;attribut Export permet d&rsquo;informer MEF qu&rsquo;il se trouve en présence d&rsquo;un plugin qui respecte un contrat particulier.   <br />L&rsquo;attribut Import permet d&rsquo;indiquer à MEF qu&rsquo;il doit se débrouiller pour nous fournir quelque chose qui respecte un contrat précis. </p>
<p>MEF est actuellement en développement (Preview 9 à l&rsquo;heure où j&rsquo;écris ces lignes), son API est susceptible d&rsquo;évoluer. </p>
<p>Pour illustrer cette introduction, nous allons construire une petite application de démo.   <br />Pour utiliser MEF, il suffit de récupérer le code à cet emplacement <a href="http://www.codeplex.com/MEF">http://www.codeplex.com/MEF</a> et de copier la DLL System.ComponentModel.Composition.dll. </p>
<p>Je créé une application Console que je nomme testMef puis 2 projet de type Class Library que je nomme HelloWorldService.Contract et HelloWorldService. </p>
<p>HelloWorldService.Contract contiendra l&rsquo;interface suivante : </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">interface</span> IHelloWorldService</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">string</span> Hello(<span style="color: #0000ff">string</span> who);</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
</div>
</div>
<p>HelloWorldService contiendra le classe suivante : </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> HelloWorldService : IHelloWorldService</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Hello(<span style="color: #0000ff">string</span> who)</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         <span style="color: #0000ff">return</span> <span style="color: #006080">"Hello "</span> + who;</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     }</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> }</pre>
</div>
</div>
<p>Dans mon application console, je crée une classe ClassicRunner qui va instancier mon service et appeler sa méthode Hello.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ClassicRunner</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Run()</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         IHelloWorldService helloWorldService = <span style="color: #0000ff">new</span> HelloWorldService.HelloWorldService();</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Console.WriteLine(helloWorldService.Hello(<span style="color: #006080">"Nico"</span>));</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     }</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> }</pre>
</div>
</div>
<p>Nous introduisons ici une dépendance forte au projet HelloWorldService. </p>
<p>Je peux bien sur utiliser cette classe dans le point d&rsquo;entrée de mon application console avec :</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Program</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args)</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         ClassicRunner classicRunner = <span style="color: #0000ff">new</span> ClassicRunner();</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         classicRunner.Run();</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     }</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> }</pre>
</div>
</div>
<p>Maintenant, faisons la même chose à la mode MEF. </p>
<p>La première chose à faire est de dire à MEF que la classe HelloWorldService est un plugin et se rend disponible pour un contrat particulier. Comme expliqué en introduction, cela se fait avec l&rsquo;attribut Export :</p>
<p> </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> [Export(<span style="color: #0000ff">typeof</span>(IHelloWorldService))]</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> HelloWorldService : IHelloWorldService</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Hello(<span style="color: #0000ff">string</span> who)</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         <span style="color: #0000ff">return</span> <span style="color: #006080">"Hello "</span> + who;</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     }</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> }</pre>
</div>
</div>
<p>Créons maintenant une classe MefRunner qui va s&rsquo;occuper d&rsquo;appeler un plugin respectant le contrat IHelloWorldService.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MefRunner</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     [Import]</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">public</span> IHelloWorldService HelloWorldService { get; set; }</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>  </pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Run()</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>         Compose();</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>         Console.WriteLine(HelloWorldService.Hello(<span style="color: #006080">"Nico"</span>));</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     }</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>  </pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>     <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> Compose()</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>         <span style="color: #0000ff">string</span> currentDirectory = <span style="color: #0000ff">new</span> FileInfo(Assembly.GetCallingAssembly().Location).Directory.ToString();</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>         AggregateCatalog catalog = <span style="color: #0000ff">new</span> AggregateCatalog(<span style="color: #0000ff">new</span> AssemblyCatalog(Assembly.GetExecutingAssembly()), <span style="color: #0000ff">new</span> DirectoryCatalog(currentDirectory));</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>         var container = <span style="color: #0000ff">new</span> CompositionContainer(catalog);</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>         container.ComposeParts(<span style="color: #0000ff">this</span>);</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>     }</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span> }</pre>
</div>
</div>
<p>On voit ici qu&rsquo;on déclare une propriété de type IHelloWorldService, décorée de l&rsquo;attribut Import. Cela nous permet de demander à MEF de se débrouiller pour nous fournir quelque chose qui respecte le contrat de la propriété.<br />
  <br />Il nous faut maintenant demander à MEF de s&rsquo;initialiser et d&rsquo;utiliser sa capacité de découverte de plug-in pour aller fouiller à un emplacement s&rsquo;il y a un plugin qui pourrait nous être utile. </p>
<p>Pour ce faire, on va utiliser l&rsquo;objet AggregateCatalog pour lui indiquer de chercher dans l&rsquo;assembly courante et dans le répertoire de l&rsquo;exécutable (ce qu&rsquo;on trouve dans la méthode Compose). </p>
<p>enfin, le CompositionContainer permet d&rsquo;initialiser MEF. </p>
<p>On voit dans le code du MefRunner qu&rsquo;aucune référence n&rsquo;est faite au projet HelloWorldService.<br />
  <br />Cependant, la DLL doit bien sur être présente dans le répertoire que nous avons indiqué à MEF (ici, le répertoire de l&rsquo;exécutable). </p>
<p>Il ne restera qu&rsquo;à appeler le MefRunner :</p>
<p> </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Program</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args)</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         MefRunner mefRunner = <span style="color: #0000ff">new</span> MefRunner();</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         mefRunner.Run();</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     }</pre>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> }</pre>
</div>
</div>
<p>Notez que MEF n&rsquo;est pas un IOC, comme Unity. Mais il se sert des techniques d&rsquo;inversions de contrôles pour son système de plugin.<br />
  <br />On peut considérer qu&rsquo;un IOC est approprié quand il s&rsquo;agit de charger des dépendances connues à l&rsquo;avance, alors que MEF est plutôt adapté à la découverte de dépendances inconnues. </p>
<p>Vous pouvez télécharger l&rsquo;application exemple <a href="ftp://ftp-developpez.com/nico-pyright/blog/testMef.zip" target="_blank">à cet emplacement</a>.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
