<?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>张文杰的博客 &#187; .NET Framework</title>
	<atom:link href="http://zhangwenjie.net/archives/tag/net-framework/feed" rel="self" type="application/rss+xml" />
	<link>http://zhangwenjie.net</link>
	<description>技术、生活博客</description>
	<lastBuildDate>Mon, 24 Oct 2011 14:23:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>.NET Framework 4.0中的按需构造:Lazy</title>
		<link>http://zhangwenjie.net/archives/263</link>
		<comments>http://zhangwenjie.net/archives/263#comments</comments>
		<pubDate>Sat, 30 Jan 2010 15:09:03 +0000</pubDate>
		<dc:creator>zhangwenjie</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://zhangwenjie.net/?p=263</guid>
		<description><![CDATA[假设您正在编写一个应用程序，在某些情况下需要使用一个特定对象。此外，假设您需要的对象的创建和使用是非常昂贵的,你不想每次您的应用程序运行时都创建它，只在你需要它的时候才创建它...]]></description>
			<content:encoded><![CDATA[<p>　　假设您正在编写一个应用程序，在某些情况下需要使用一个特定对象。此外，假设您需要的对象的创建和使用是非常昂贵的,你不想每次您的应用程序运行时都创建它，只在你需要它的时候才创建它。</p>
<p>　　当然你可以自己管理这一切，但 Lazy&lt;T&gt;将使这个任务变得容易。你只需要在那个”昂贵”的对象上创建一个 lazy包装器：</p>
<pre lang="C#">Lazy&lt;ExpensiveResource&gt; ownedResource = new Lazy&lt;ExpensiveResource&gt;();</pre>
<p>　　然后你可以简单引用 ‘ownedResource.Value’来获取那个”昂贵”的对象。当你第一次访问ownedResource.Value时,这个”昂贵”的资源才会被分配，而不是以前就分配。</p>
<p>　　Lazy&lt;T&gt;同时还有一个boolean属性，叫IsValueCreated，你可以检查这个属性来查看值是否已经创建。</p>
<p>　　<strong>支持没有默认构造函数的类型</strong></p>
<p><strong>　　</strong>Lazy&lt;T&gt; 不会强制new()约束。你可以在支持不同构造函数，甚至工厂方法实例化的类型上使用Lazy&lt;T&gt;。第二个构造函数指定一个返回新”昂贵”资源的泛型方法：Func&lt;T&gt;：</p>
<pre lang="C#">Lazy ownedResource = new Lazy(    () =&gt; new ExpensiveResource("filename.data"));</pre>
<p>　　你可以使用这个第二个构造函数来更好的控制使用什么样的代码来创建这个”昂贵”的资源。我在这使用了一个不同的构造函数，但你可以使用工厂方法、IOC容器、或其它方法。</p>
<p>　　<strong>我们生活在多核的世界</strong></p>
<p><strong>　　 </strong>Lazy&lt;T&gt;另有两个其它构造函数：</p>
<pre lang="C#">public Lazy(bool isThreadSafe);
public Lazy(Func&lt;T&gt; valueFactory, bool isThreadSafe);</pre>
<p>　　这两个构造函数指示出程序运行在多核的环境中。”昂贵”对象延迟(lazy)创建必须进行同步。（毕竟是”昂贵”对象，你不会需要两个这种对象）。</p>
<p>　　这是一个简单的类型，但正是这些类型你将一次又一次使用他们。</p>
<p>　　首发张文杰的博客:http://zhangwenjie.net （转载请保留，谢谢）。本文地址： http://zhangwenjie.net/archives/263.html <a href="options-permalink.php" target="_blank"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://zhangwenjie.net/archives/263/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>微软宣布Visual Studio 2010正式版发布日期</title>
		<link>http://zhangwenjie.net/archives/65</link>
		<comments>http://zhangwenjie.net/archives/65#comments</comments>
		<pubDate>Mon, 19 Oct 2009 08:52:10 +0000</pubDate>
		<dc:creator>zhangwenjie</dc:creator>
				<category><![CDATA[互联网]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[微软]]></category>

		<guid isPermaLink="false">http://zhangwenjie.net/?p=65</guid>
		<description><![CDATA[早在今年5月份微软就发布了Visual Studio 2010和.NET Framework 4.0的首个Beta测试版，今天微软宣布已经为MSDN订阅用户提供了VS 2010的第二个Beta版，普通用户将在10月21日获取免费下载...]]></description>
			<content:encoded><![CDATA[<p>早在今年5月份微软就发布了Visual Studio 2010和.NET Framework 4.0的首个Beta测试版，今天微软宣布已经为MSDN订阅用户提供了VS 2010的第二个Beta版，普通用户将在<strong>10月21日</strong>获取免费下载。</p>
<p>此外，微软还宣布了Visual Studio 2010的官方正式发布日期，定在<strong>2010年3月22日</strong>，并且表示这将是近几年来Visual Studio和.NET Framework最重要的一次版本升级，新增功能包括Windows 7和SharePoint 2010工具以及对并行编程的支持等。</p>
<p>VS2010开发代号“Rosario”(阿根廷港市罗萨里奥)，除了上述功能外还在以下方面进行了改进：</p>
<ol>
<li>完善了Visual Studio IDE；</li>
<li>Visual Basic和C#语言：在Visual Studio 2010中，VB和C#语言的演变是对等的，开发人员可以根据自己的爱好选择任意一种语言；</li>
<li>Visual Studio 2010包括一种新的.NET Framework语言：F#；</li>
<li>Web开发：VS 2010改进了代码编写的速度，简化了Web开发，还支持基于MVC的Web应用等；</li>
<li>WPF和Silverlight：改进了对WPF和Silverlight应用程序的开发；</li>
<li>完善了Visual C++功能。</li>
</ol>
<p>VS2010的截图如下：</p>
<div class="wp-caption aligncenter" style="width: 510px"><img class=" " title="Visual Studio 2010外观截图" src="http://img2.zol.com.cn/product/28_500x2000/878/ce2jL5wFm2n8s.jpg" alt="VS2010" width="500" height="400" /><p class="wp-caption-text">Visual Studio 2010外观截图</p></div>
<div class="wp-caption aligncenter" style="width: 510px"><img title="Visual Studio 2010外观截图" src="http://img2.zol.com.cn/product/28_500x2000/879/ce4UiZuRkuOL2.jpg" alt="Visual Studio 2010外观截图" width="500" height="354" /><p class="wp-caption-text">Visual Studio 2010外观截图</p></div>
<p>官方下载Visual Studio 2010 Beta 1：<br />
<a style="color: #0000ff; text-decoration: underline;" href="http://blogs.msdn.com/onoj/archive/2009/05/19/visual-studio-2010-beta-1-download-options.aspx" target="_blank">http://blogs.msdn.com/onoj/archive/2009/05/19/visual-studio-2010-beta-1-download-options.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://zhangwenjie.net/archives/65/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

