<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3090991703190749969</id><updated>2012-02-08T08:20:58.801-08:00</updated><category term='debug'/><category term='GCD'/><category term='other'/><category term='Microsoft'/><category term='tools'/><category term='VisualStudio'/><category term='Euclidean'/><category term='BizTalk'/><category term='serialization'/><category term='arithmetics'/><category term='Caching'/><category term='Windows'/><category term='Generics'/><category term='Oracle'/><category term='IIS'/><category term='Web'/><category term='ADO.NET'/><category term='C#'/><category term='SOAP'/><category term='addin'/><category term='WSDL'/><category term='nuget'/><category term='perfmon'/><category term='build'/><category term='sql'/><category term='WCF'/><category term='extension'/><category term='mathematics'/><category term='exception'/><category term='performance'/><category term='deserialization'/><category term='Silverlight'/><category term='.NET'/><category term='svcutil'/><title type='text'>thinking loudly about geeky stuff</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-8347099860937381305</id><published>2012-02-08T08:15:00.000-08:00</published><updated>2012-02-08T08:20:58.815-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nuget'/><title type='text'>How to update references to a 3rd party assembly in all the projects in the solution?</title><content type='html'>Let's say you have a 3rd party assembly referenced in many projects in your solution. Once a new version of the 3rd party assembly is released, you probably would like to update the references in all your projects in a solution to the new version.&lt;br /&gt;&lt;br /&gt;Are you using NuGet to update 3rd party libraries? &lt;br /&gt;If the answer no, install Extension for Visual Studio RIGHT NOW from &lt;a href="http://nuget.org/"&gt;NuGet&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Copy the following script to the root directory of your solution&lt;br /&gt;&lt;script src="https://gist.github.com/747529.js?file=Upgrade-Package.ps1"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Navigate to View -&gt; Other Windows -&gt; Package Management Console&lt;br /&gt;&lt;br /&gt;Run the following command&lt;br /&gt;&lt;br /&gt;PM&gt; .\Upgrade-Package.ps1 -PackageID:log4net&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-8347099860937381305?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/8347099860937381305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=8347099860937381305' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8347099860937381305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8347099860937381305'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2012/02/how-to-update-references-to-3rd-party.html' title='How to update references to a 3rd party assembly in all the projects in the solution?'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-5100254300351831240</id><published>2012-01-29T08:22:00.000-08:00</published><updated>2012-01-29T08:22:00.857-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><category scheme='http://www.blogger.com/atom/ns#' term='perfmon'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>How to monitor WCF Service up time using Performance Counters?</title><content type='html'>I was asked to monitor how long WCF service is up using Performance Counters. There is no WCF specific counter that displays this. Actually it depends on the hosting of your WCF service. &lt;br /&gt;&lt;br /&gt;- If the service is hosted in IIS, use "Service Uptime" performance counter under "Web Service Category"&lt;br /&gt;- If the service is hosted in Console application or Windows Service, you can use "Elapsed Time" in "Process" category&lt;br /&gt;&lt;br /&gt;Thanks to &lt;a href="http://www-jo.se/f.pfleger"&gt;Josef Pfleger&lt;/a&gt; for answering my &lt;a href="http://stackoverflow.com/questions/9051958/how-to-monitor-wcf-service-up-time-using-performance-counters"&gt;question&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-5100254300351831240?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/5100254300351831240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=5100254300351831240' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/5100254300351831240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/5100254300351831240'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2012/01/how-to-monitor-wcf-service-up-time.html' title='How to monitor WCF Service up time using Performance Counters?'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-9071246267664759108</id><published>2012-01-04T00:18:00.000-08:00</published><updated>2012-01-04T00:18:57.497-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='extension'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='addin'/><category scheme='http://www.blogger.com/atom/ns#' term='VisualStudio'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Best Visual Studio add in for debugging .NET</title><content type='html'>I am sure it happens for most of us: when you debug some code, you need to see a certain property in debug without changing the ToString() implementation or to see the return value of a method without stepping out of it. You say in heart "I wish it would be possible" and continue to debug the old way. Two courage guys Vitaly Belman and Omer Aviv had quit their job to make their dream true. They have developed a Visual Studio addin that makes what ReSharper to the code writing. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe width="560" height="315" src="http://www.youtube.com/embed/0GuAq76-D-s" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Free trial for 60 days:&lt;br /&gt;&lt;a href="http://www.bugaidsoftware.com/"&gt;http://www.bugaidsoftware.com/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-9071246267664759108?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/9071246267664759108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=9071246267664759108' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/9071246267664759108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/9071246267664759108'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2012/01/best-visual-studio-add-in-for-debugging.html' title='Best Visual Studio add in for debugging .NET'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/0GuAq76-D-s/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-8576764473640769851</id><published>2011-11-17T05:24:00.000-08:00</published><updated>2011-11-18T15:23:17.303-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOAP'/><category scheme='http://www.blogger.com/atom/ns#' term='svcutil'/><category scheme='http://www.blogger.com/atom/ns#' term='WSDL'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>There was a problem loading the XSD documents provided: a reference to a schema element with name X and namespace Y could not be resolved because the element definition could not be found in the schema for targetNamespace Z.</title><content type='html'>Posting this one mostly as a reminder for myself:&lt;br /&gt;&lt;br /&gt;I was working on extending some existing WCF service in development, while an older version already deployed to production. Let's say our production site is &lt;br /&gt;www.borismod.com&lt;br /&gt;and my local machine name is borism&lt;br /&gt;When I tried to create a local proxy of the web service I got the following error:&lt;br /&gt;&lt;br /&gt;(all the ULRs and namespaces are fictive) &lt;br /&gt;&lt;br /&gt;&gt;svcutil http://www.borismod.com/RealGeekyURL/mex&lt;br /&gt;&lt;br /&gt;Attempting to download metadata from 'http://www.borismod.com/RealGeekyURL/mex' using WS-Metadata Exchange or DISCO.&lt;br /&gt;Error: Cannot import wsdl:portType&lt;br /&gt;Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter&lt;br /&gt;Error: There was a problem loading the XSD documents provided: a reference to a schema element with name 'DoSomeCrazyGeekyStuff' and namespace 'http://borismod.blogspot.com/' could not be resolved because the element definition could not be found in the schema for targetNamespace 'http://www.borismod.com/'. Please check the XSD docu&lt;br /&gt;ments provided and try again.&lt;br /&gt;XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.borismod.com/']/wsdl:portType[@name='ISomeRealGeekService']&lt;br /&gt;&lt;br /&gt;Problem:&lt;br /&gt;The actual problem is that there are references from the WSDL to some internal classes. The references point to the production site. The new added classes were missing in production. &lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;Point in host file to the local machine, actually adding the following line in hosts file:&lt;br /&gt;127.0.0.1 www.borismod.com&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-8576764473640769851?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/8576764473640769851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=8576764473640769851' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8576764473640769851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8576764473640769851'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2011/11/there-was-problem-loading-xsd-documents.html' title='There was a problem loading the XSD documents provided: a reference to a schema element with name X and namespace Y could not be resolved because the element definition could not be found in the schema for targetNamespace Z.'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-5130558147399973438</id><published>2011-09-14T01:31:00.000-07:00</published><updated>2011-09-14T01:31:14.134-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Windows 8 Build event</title><content type='html'>Haven't been here for a while, will try to update the blog more frequently. I attended a Microsoft Build event yesterday where guys and a girl from Redmond presented the next operating system - Windows 8. The presentation was held in the US and was broadcast live worldwide.  &lt;br /&gt;&lt;br /&gt;So what are the new buzz words we hear in the next years:&lt;br /&gt;- WinRT - a new run-time to provide a unified access to all languages: C, C++, C#, VB.NET and Javascript&lt;br /&gt;- Reset/Restore will replace the familiar Restore Points. Creating your own "reset" point is available in command line utility only&lt;br /&gt;- Metrostyle - is the new unified styling of applications supporting multi-touch, sliding etc&lt;br /&gt;&lt;br /&gt;Additional features are:&lt;br /&gt;- Publishing applications to the cloud. All the apps will be certified by "the big brother" to have no malicious code&lt;br /&gt;- I was also impressed by boot up performance, it's a real improvement&lt;br /&gt;&lt;br /&gt;Good work!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-5130558147399973438?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/5130558147399973438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=5130558147399973438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/5130558147399973438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/5130558147399973438'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2011/09/windows-8-build-event.html' title='Windows 8 Build event'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-4846860466670122874</id><published>2010-07-22T07:30:00.000-07:00</published><updated>2010-07-22T07:30:12.501-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Caching'/><title type='text'>Microsoft AppFabric (former Velocity code name)</title><content type='html'>I visited yesterday a "&lt;b&gt;Introduction to AppFabric caching&lt;/b&gt;" session in Microsoft offices in Raanana. The session was held by AppFabric team developer  - &lt;i&gt;Shani Pozin&lt;/i&gt;. In this post I'd like to summarize the session for those who missed it and as a reminder for myself.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is AppFabric Caching?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;1. A successor of Velocity - a distributed cache service&lt;br /&gt;2. A part of AppFabric - Microsoft vision of application server&lt;br /&gt;3. A competitor to Memcached, NCache and others&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What does it do?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It provides an abstract level of clustered distributed caching for serializable objects. Cached data is stored in different physical machines in order to enable High Availability. Each value is stored in two machines (if configured) Primary and Secondary. If Primary fails, then Secondary becomes Primary and another machine becomes Secondary. If Secondary fails, another machine is chosen to be secondary.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What are additional things it knows to do?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;1. There is support for locking objects they are retrieved from cache. It is provided by GetAndLock and PutAndUnlock methods. It is important to mention, that if object is locked by one thread the other one will receive an exception and will not be blocked.&lt;br /&gt;2. There is support for versioning cached objects. If a thread is trying to Put an older version of cached object, it will experience an exception, saying that it has to get the most updated version from cache.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What it does not do?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;1. It does not persist cached data, which is different than Velocity worked. There were several options for data persistency: SQL Server, XML file, MDF file.&lt;br /&gt;3. It does not provide Read-through and Write-behind features. It is promised, that they will be supported in future releases&lt;br /&gt;&lt;br /&gt;If/when the presentation will be available on the web, I'll put a link here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-4846860466670122874?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/4846860466670122874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=4846860466670122874' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/4846860466670122874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/4846860466670122874'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2010/07/microsoft-appfabric-former-velocity.html' title='Microsoft AppFabric (former Velocity code name)'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-5792139225084288023</id><published>2010-06-23T03:06:00.000-07:00</published><updated>2010-06-23T03:06:23.909-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Get browser information from Silverlight</title><content type='html'>Recently I needed to detect information about browser version within Silverlight. After googling around I found many posts that pointed to built-in class BrowserInformation, which can be accessed via System.Windows.Browser.HtmlPage.BrowserInformation. &lt;br /&gt;&lt;br /&gt;So I should be happy and use its Name and BrowserVersion properties? &lt;br /&gt;&lt;br /&gt;No, because BrowserVersion property returns something similar to HTML version instead of the real browser version. For example, on "Internet Explorer 7.0", it returns "4.0"&lt;br /&gt;&lt;br /&gt;The "real" browser version can be extracted from the mysterious UserAgent property, just like this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;static&lt;/font&gt; &lt;font color="#0000ff"&gt;string&lt;/font&gt; BrowserName()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;string&lt;/font&gt; userAgent = HtmlPage.BrowserInformation.UserAgent;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (userAgent.IndexOf(&lt;font color="#A31515"&gt;"MSIE 8.0"&lt;/font&gt;) &amp;#62; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#A31515"&gt;"Internet Explorer 8.0"&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (userAgent.IndexOf(&lt;font color="#A31515"&gt;"MSIE 7.0"&lt;/font&gt;) &amp;#62; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#A31515"&gt;"Internet Explorer 7.0"&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (userAgent.IndexOf(&lt;font color="#A31515"&gt;"MSIE 6.0"&lt;/font&gt;) &amp;#62; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#A31515"&gt;"Internet Explorer 6.0"&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (userAgent.IndexOf(&lt;font color="#A31515"&gt;"MSIE 5.0"&lt;/font&gt;) &amp;#62; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#A31515"&gt;"Internet Explorer 5.0"&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (userAgent.IndexOf(&lt;font color="#A31515"&gt;"Firefox"&lt;/font&gt;) &amp;#62; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#A31515"&gt;"Mozilla "&lt;/font&gt; + userAgent.Substring(userAgent.IndexOf(&lt;font color="#A31515"&gt;"Firefox"&lt;/font&gt;), 100).Replace(&lt;font color="#A31515"&gt;'/'&lt;/font&gt;, &lt;font color="#A31515"&gt;' '&lt;/font&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (userAgent.IndexOf(&lt;font color="#A31515"&gt;"Chrome"&lt;/font&gt;) &amp;#62; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#A31515"&gt;"Google "&lt;/font&gt; + userAgent.Substring(userAgent.IndexOf(&lt;font color="#A31515"&gt;"Chrome"&lt;/font&gt;), userAgent.IndexOf(&lt;font color="#A31515"&gt;"Safari"&lt;/font&gt;) - userAgent.IndexOf(&lt;font color="#A31515"&gt;"Chrome"&lt;/font&gt;)).Replace(&lt;font color="#A31515"&gt;'/'&lt;/font&gt;, &lt;font color="#A31515"&gt;' '&lt;/font&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (userAgent.IndexOf(&lt;font color="#A31515"&gt;"Safari"&lt;/font&gt;) &amp;#62; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#A31515"&gt;"Safari "&lt;/font&gt; + userAgent.Substring(userAgent.IndexOf(&lt;font color="#A31515"&gt;"Version"&lt;/font&gt;), userAgent.IndexOf(&lt;font color="#A31515"&gt;"Safari"&lt;/font&gt;) - userAgent.IndexOf(&lt;font color="#A31515"&gt;"Version"&lt;/font&gt;)).Replace(&lt;font color="#A31515"&gt;"Version/"&lt;/font&gt;, &lt;font color="#2B91AF"&gt;String&lt;/font&gt;.Empty);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (userAgent.IndexOf(&lt;font color="#A31515"&gt;"Opera"&lt;/font&gt;) &amp;#62; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; userAgent.Substring(userAgent.IndexOf(&lt;font color="#A31515"&gt;"Opera"&lt;/font&gt;), userAgent.IndexOf(&lt;font color="#A31515"&gt;"("&lt;/font&gt;) - 2).Replace(&lt;font color="#A31515"&gt;'/'&lt;/font&gt;, &lt;font color="#A31515"&gt;' '&lt;/font&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#A31515"&gt;"Unknown Browser"&lt;/font&gt;;&lt;br /&gt;}&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;The code was successfully tested on IE and Chrome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-5792139225084288023?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/5792139225084288023/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=5792139225084288023' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/5792139225084288023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/5792139225084288023'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2010/06/get-browser-information-from.html' title='Get browser information from Silverlight'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-8397271670391174882</id><published>2010-03-04T08:06:00.000-08:00</published><updated>2010-03-07T00:57:59.977-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VisualStudio'/><title type='text'>Upgrade to Visual Studio 2010 Release Candidate</title><content type='html'>After using VS2010 Beta for a while, I upgraded it to RC recently. It seems to be more stable and robust. So here are steps for upgrade:&lt;br /&gt;&lt;br /&gt;1. Uninstall VS 2010 Beta&lt;br /&gt;2. Install VS 2010 RC&lt;br /&gt;3. Run VS2010 RC setup again and choose Repair&lt;br /&gt;4. Download and install &lt;a href="http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=26662"&gt;Hotfix KB980610&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;UPDATE March 7, 2010:&lt;br /&gt;5. Download and install &lt;a href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=27019&amp;wa=wsignin1.0"&gt;Hotfix KB980920&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-8397271670391174882?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/8397271670391174882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=8397271670391174882' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8397271670391174882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8397271670391174882'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2010/03/upgrade-to-visual-studio-2010-release.html' title='Upgrade to Visual Studio 2010 Release Candidate'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-6094369745293798776</id><published>2010-03-04T03:28:00.000-08:00</published><updated>2010-03-04T03:28:02.110-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='deserialization'/><title type='text'>Deep cloning object in C#/.NET</title><content type='html'>I was asked recently to write a generic method for deep cloning of a complex object. The object contains references to other objects, collections, which contain references to many other objects and collections. The method was supposed to work on both platforms: .NET 3.5 (or higher) and Silverlight. &lt;br /&gt;&lt;br /&gt;While googling I found a good post listing different approaches for cloning&lt;br /&gt;&lt;a href="http://www.csharp411.com/c-object-clone-wars/"&gt;C# Object Clone Wars&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Last technique described in that blog points to &lt;a href="http://ox.no/posts/extension-methods-for-copying-or-cloning-objects"&gt;Copyable Framework&lt;/a&gt; - generic framework for copying/cloning any objects using method extensions&lt;br /&gt;&lt;br /&gt;The framework, written by Håvard Stranden addresses most of my requirements, except one: it does not work on Silverlight.&lt;br /&gt;&lt;br /&gt;I came up with a simple method that serializes the original object and deserializes it to a cloned copy of it. It can be used as an extension or by implementing IClonable interface:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;static&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; ObjectExtensions&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;static&lt;/font&gt; T Clone&amp;#60;T&amp;#62;(&lt;font color="#0000ff"&gt;this&lt;/font&gt; &lt;font color="#0000ff"&gt;object&lt;/font&gt; original)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;T cloned;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;using&lt;/font&gt; (MemoryStream stream = &lt;font color="#0000ff"&gt;new&lt;/font&gt; MemoryStream())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DataContractSerializer serializer = &lt;font color="#0000ff"&gt;new&lt;/font&gt; DataContractSerializer(&lt;font color="#0000ff"&gt;typeof&lt;/font&gt;(T));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;serializer.WriteObject(stream, original);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stream.Position = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cloned = (T)serializer.ReadObject(stream);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; cloned;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-6094369745293798776?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/6094369745293798776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=6094369745293798776' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/6094369745293798776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/6094369745293798776'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2010/03/deep-cloning-object-in-cnet.html' title='Deep cloning object in C#/.NET'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-8955442218080759172</id><published>2010-02-09T07:57:00.000-08:00</published><updated>2010-02-09T07:57:42.803-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>WCF Serialization Tips</title><content type='html'>Here are a few tips on how to improve WCF performance and traffic by simple putting the right attributes on your serializable classes:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. "Avoid inferred data contracts (POCO). Always be explicit and apply the DataContract attribute" (C) Juval Löwy&lt;br /&gt;2. "Use the DataMember attribute only on properties or read-only public members" (C) Juval Löwy&lt;br /&gt;3. Mark [DataMember] only properties, that DO have to be serialized. Avoid marking calculated properties as DataMember&lt;br /&gt;2. Consider using (IsReference = true) on classes to avoid data duplication and circular references. &lt;br /&gt;3. Use short (one or two letters) Name on classes and properties to significantly reduce traffic. (C) Eyal Vardi&lt;br /&gt;4. Specify short Value for EnumMember&lt;br /&gt;5. Use parametrized DataContract property for generic classes&lt;br /&gt;6. Use (EmitDefaultValue=false) on properties to reduce traffic&lt;br /&gt;&lt;br /&gt;Sample:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt; [DataContract(Name=&lt;font color="#A31515"&gt;"CT"&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;enum&lt;/font&gt; CustomerTypes&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[EnumMember(Value = &lt;font color="#A31515"&gt;"I"&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Internal,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[EnumMember(Value = &lt;font color="#A31515"&gt;"E"&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;External,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[EnumMember(Value = &lt;font color="#A31515"&gt;"U"&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Unknown&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;[DataContract(IsReference = &lt;font color="#0000ff"&gt;true&lt;/font&gt;, Name = &lt;font color="#A31515"&gt;"B{0}"&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; BusinessBase&amp;#60;T&amp;#62;&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;T Id { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;[DataContract(IsReference = &lt;font color="#0000ff"&gt;true&lt;/font&gt;, Name = &lt;font color="#A31515"&gt;"C"&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; Customer : BusinessBase&amp;#60;&lt;font color="#0000ff"&gt;int&lt;/font&gt;&amp;#62; &lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[DataMember(Name=&lt;font color="#A31515"&gt;"C"&lt;/font&gt;, EmitDefaultValue=&lt;font color="#0000ff"&gt;false&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; CustomerTypes&amp;nbsp;CustomerType { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[DataMember(Name = &lt;font color="#A31515"&gt;"N"&lt;/font&gt;, EmitDefaultValue = &lt;font color="#0000ff"&gt;false&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;string&lt;/font&gt; Name { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[DataMember(Name = &lt;font color="#A31515"&gt;"P"&lt;/font&gt;, EmitDefaultValue = &lt;font color="#0000ff"&gt;false&lt;/font&gt;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; Customer ParentCustomer { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;bool&lt;/font&gt; IsGoodCustomer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;get&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#0000ff"&gt;this&lt;/font&gt;.CustomerType == CustomerTypes.Internal || &lt;font color="#0000ff"&gt;this&lt;/font&gt;.CustomerType == CustomerTypes.External;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-8955442218080759172?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/8955442218080759172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=8955442218080759172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8955442218080759172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8955442218080759172'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2010/02/wcf-serialization-tips.html' title='WCF Serialization Tips'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-39423396388938111</id><published>2009-11-04T08:34:00.000-08:00</published><updated>2009-11-04T08:34:16.052-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>System.Data.DataRow indexer complexity</title><content type='html'>Have you ever wonder what is the time complexity of accessing DataRow by column name? Unfortunately, this information is not specified on MSDN.&lt;br /&gt;&lt;br /&gt;So the obvious answer would be O(n). We might think that there is iteration on data columns and in worst case it would iterate on all of them.&lt;br /&gt;&lt;br /&gt;The actual answer can be discovered by looking on System.Data.dll using Reflector. We'll see there, that there is an access to Hashtable of column names by name, which obviosly take O(1).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;So the overall complexity of the following would be O(1).&lt;br /&gt;&lt;br /&gt;object data = row["CUSTOMER"];&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-39423396388938111?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/39423396388938111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=39423396388938111' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/39423396388938111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/39423396388938111'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2009/11/systemdatadatarow-indexer-complexity.html' title='System.Data.DataRow indexer complexity'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-5170613017517641801</id><published>2009-09-30T06:53:00.000-07:00</published><updated>2009-09-30T07:11:34.384-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>How to retrieve new row data from INSERT using Oracle DataAccess</title><content type='html'>Answering a &lt;a href="http://stackoverflow.com/questions/1433668/how-to-retrieve-new-row-data-from-insert-using-oracle-dataaccess-with-powershell"&gt;question&lt;/a&gt; on StackOverflow:&lt;br /&gt;&lt;br /&gt;"I am using Oracle database server with Oracle DataAccess client. What I need to do is INSERT a new row of data, then retrieve the auto-generated ID field of the newly-created row for another INSERT command, immediately following. What is the best way to do this?"&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt;1. Modify the INSERT query by adding RETURNING keyword&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt;"&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt; &lt;font color="#0000ff"&gt;INTO&lt;/font&gt; table_name (column_name1, column_name2) &lt;font color="#0000ff"&gt;VALUES&lt;/font&gt; (&lt;font color="#A31515"&gt;'val1'&lt;/font&gt;, &lt;font color="#A31515"&gt;'val2'&lt;/font&gt;) &lt;br /&gt;&lt;font color="#0000ff"&gt;RETURNING&lt;/font&gt; module_id &lt;font color="#0000ff"&gt;INTO&lt;/font&gt; :column_id"&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;2. Add a bind variable to your OracleCommand named "column_id"&lt;br /&gt;3. Take its value after the command is executed&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-5170613017517641801?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/5170613017517641801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=5170613017517641801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/5170613017517641801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/5170613017517641801'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2009/09/how-to-retrieve-new-row-data-from.html' title='How to retrieve new row data from INSERT using Oracle DataAccess'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-3567549897365109823</id><published>2009-06-15T07:11:00.000-07:00</published><updated>2009-06-15T07:59:16.194-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='deserialization'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>V2: WCF CollectionDataContract and DataMember attributes</title><content type='html'>Following Jeff's comment on the first version of this post, here are some explanations and a full class.&lt;br /&gt;&lt;br /&gt;Q1. Why did I write "implement IEnumerable" twice?&lt;br /&gt;A1. My original intention was to derive my class from ICollection&amp;lt;T&amp;gt;. Thus I had to implement IEnumerable and IEnumerable&amp;lt;T&gt;. &lt;br /&gt;&lt;br /&gt;Q2. Why do I bother to implement IEnumerable at all if the class is not "decorated" as IEnumerable?&lt;br /&gt;A2. ICollection&amp;lt;T&amp;gt; "derives" from IEnumerable&amp;lt;T&amp;gt; and IEnumerable, so we have to implement both of them when writing a class that implements ICollection&amp;lt;T&amp;gt;&lt;br /&gt;&lt;br /&gt;Here is a complete class:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt;&amp;nbsp;[DataContract]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; EntityCollectionWorkaround&amp;#60;EntityType&amp;#62; : ICollection&amp;#60;EntityType&amp;#62; &lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;#region&lt;/font&gt; Constructor&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; EntityCollectionWorkaround()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Entities = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#2B91AF"&gt;List&lt;/font&gt;&amp;#60;EntityType&amp;#62;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;#endregion&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[DataMember]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;int&lt;/font&gt; AdditionalProperty { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[DataMember]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#2B91AF"&gt;List&lt;/font&gt;&amp;#60;EntityType&amp;#62; Entities { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;#region&lt;/font&gt; ICollection&amp;#60;T&amp;#62; Members&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; Add(EntityType item)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Entities.Add(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; Clear()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;this&lt;/font&gt;.Entities.Clear();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;bool&lt;/font&gt; Contains(EntityType item)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; Entities.Contains(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; CopyTo(EntityType[] array, &lt;font color="#0000ff"&gt;int&lt;/font&gt; arrayIndex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;this&lt;/font&gt;.Entities.CopyTo(array, arrayIndex);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;int&lt;/font&gt; Count&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;get&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#0000ff"&gt;this&lt;/font&gt;.Entities.Count;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;bool&lt;/font&gt; IsReadOnly&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;get&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#0000ff"&gt;false&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;bool&lt;/font&gt; Remove(EntityType item)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#0000ff"&gt;this&lt;/font&gt;.Entities.Remove(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; EntityType &lt;font color="#0000ff"&gt;this&lt;/font&gt;[&lt;font color="#0000ff"&gt;int&lt;/font&gt; index]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;get&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#0000ff"&gt;this&lt;/font&gt;.Entities[index];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;set&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;this&lt;/font&gt;.Entities[index] = &lt;font color="#0000ff"&gt;value&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;#endregion&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;#region&lt;/font&gt; &lt;font color="#2B91AF"&gt;IEnumerable&lt;/font&gt;&amp;#60;T&amp;#62; Members&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;public&lt;/font&gt; IEnumerator&amp;#60;EntityType&amp;#62; GetEnumerator()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#0000ff"&gt;this&lt;/font&gt;.Entities.GetEnumerator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;#endregion&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;#region&lt;/font&gt; &lt;font color="#2B91AF"&gt;IEnumerable&lt;/font&gt; Members&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Collections.IEnumerator System.Collections.&lt;font color="#2B91AF"&gt;IEnumerable&lt;/font&gt;.GetEnumerator()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; &lt;font color="#0000ff"&gt;this&lt;/font&gt;.Entities.GetEnumerator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;#endregion&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-3567549897365109823?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/3567549897365109823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=3567549897365109823' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/3567549897365109823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/3567549897365109823'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2009/06/v2-wcf-collectiondatacontract-and.html' title='V2: WCF CollectionDataContract and DataMember attributes'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-8431075276997420822</id><published>2009-06-08T05:13:00.000-07:00</published><updated>2009-06-08T05:58:29.104-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='build'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Post-build assembly manipulation</title><content type='html'>We often think how to modify our code during writing, debugging, but rarely after assembly is built. Well, there are a few kinds of post-build manipulations we might want to perform on compiled assemblies:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Merge&lt;/span&gt;&lt;br /&gt;This nice utility was developed by Mike Barnett from Microsoft Research and it enables merging multiple assemblies to a single one. This may be very useful, when one wants to deliver a single component or executable without exposing the internal structure of assemblies. It may be used as command-line utility (from post build action as well) and as a assembly reference and wrapped within another tool. It does not work on Silverlight assemblies, at least at the moment of writing these lines and I asked Mike to check this out.&lt;br /&gt;&lt;a href="http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx"&gt;http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Convert to Silverlight&lt;/span&gt; &lt;br /&gt;This project developed by Suriel Bendahan enables converting assemblies compiled on server-side .NET to Silverlight compatible assemblies. It makes possible to reuse code written as "server-side" on Silverlight client. It might be useful for generic data structures, generic algorithms, input validations, sharing interfaces etc. The project is provided with it sources, so it can be modified/adopted for your needs.&lt;br /&gt;&lt;a href="http://www.codeproject.com/KB/silverlight/SLAssemblies.aspx"&gt;http://www.codeproject.com/KB/silverlight/SLAssemblies.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Compress&lt;/span&gt;&lt;br /&gt;Silverlight assemblies are being downloaded to browser in a XAP file, which is a bunch of DLLs compressed using ZIP compression. This project developed by Rob Houweling uncompresses these assemblies and compresses them again with a higher compression rate. This is very useful when XAP size becomes an issue.&lt;br /&gt;&lt;a href="http://web-snippets.blogspot.com/2008/11/another-one-on-repacking-xaps-to-reduce.html"&gt;http://web-snippets.blogspot.com/2008/11/another-one-on-repacking-xaps-to-reduce.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Obfuscate&lt;/span&gt;&lt;br /&gt;Obfuscation is a process of changing the readability of the code without changing its functionality. The reason for doing this is preventing others from seeing implementation. Visual Studio comes with a Dotfuscator Community Edition and there are others providers of obfuscation utilities.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-8431075276997420822?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/8431075276997420822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=8431075276997420822' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8431075276997420822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/8431075276997420822'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2009/06/post-build-assembly-manipulation.html' title='Post-build assembly manipulation'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-3539006403500832880</id><published>2009-05-25T02:08:00.000-07:00</published><updated>2009-05-25T05:03:32.892-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mathematics'/><category scheme='http://www.blogger.com/atom/ns#' term='other'/><title type='text'>WolframAlpha</title><content type='html'>A new computational knowledge base is up and running. It calculates whatever you want, including your mortgage return, distance between cities and much more.&lt;br /&gt;&lt;br /&gt;Try it: &lt;a href="http://www.wolframalpha.com/" target="_blank"&gt;http://www.wolframalpha.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In order to add WolframAlpha to search providers of your IE click &lt;a href="http://www.microsoft.com/windows/ie/searchguide/en-en/default.mspx?dcsref=http://runonce.msn.com/runonce2.aspx"&gt;here&lt;/a&gt; and follow instructions on "Create Your Own" section&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-3539006403500832880?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/3539006403500832880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=3539006403500832880' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/3539006403500832880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/3539006403500832880'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2009/05/wolframalpha.html' title='WolframAlpha'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-393027131982923821</id><published>2009-04-27T05:29:00.000-07:00</published><updated>2009-04-27T05:39:47.049-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='other'/><title type='text'>Google surprises again</title><content type='html'>Google do not stop to surprise us with their Holiday logos. &lt;br /&gt;&lt;br /&gt;They presented their logo in a form of a Gogol's famous nose on his 200th anniversary:&lt;br /&gt;&lt;img src="http://www.google.com/logos/gogol09.gif" /&gt;&lt;br /&gt;&lt;br /&gt;Now they present a logo in Morse code on Samuel Morse's anniversary:&lt;br /&gt;&lt;img src="http://www.google.com/logos/samuelmorse09.gif"/&gt;&lt;br /&gt;&lt;br /&gt;What's next?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-393027131982923821?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/393027131982923821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=393027131982923821' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/393027131982923821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/393027131982923821'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2009/04/google-surprises-again.html' title='Google surprises again'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-1678062053488731954</id><published>2009-04-27T01:09:00.000-07:00</published><updated>2009-04-27T01:24:23.466-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><title type='text'>Great tool for files synchronizing:  GetDropBox.com</title><content type='html'>There are things, that when we discover them at first we think "How they weren't invented before?", then we get used to them very quickly and finally we can't imagine living without them. One of such things is a great tool that keeps files on your different computers synchronized. The tool is Drop Box: it creates a Drop Box folder on your computers, for example your laptop and your desktop machine and synchronizes them. So you may drop files with any directories structure on your desktop and they will appear on the laptop as well. In addition, you can browse the files on the web, share them with others etc.&lt;br /&gt;&lt;br /&gt;Follow this link, so I'll get an extra space:&lt;br /&gt;&lt;a href="https://www.getdropbox.com/referrals/NTEwMTAyMDI5" target="_blank"&gt;Drop Box&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-1678062053488731954?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/1678062053488731954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=1678062053488731954' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/1678062053488731954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/1678062053488731954'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2009/04/great-tool-for-files-synchronizing.html' title='Great tool for files synchronizing:  GetDropBox.com'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-654016344971757696</id><published>2009-04-16T08:36:00.000-07:00</published><updated>2009-04-16T08:47:43.367-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>WCF CollectionDataContract and DataMember attributes</title><content type='html'>I came to write this post just occasionally: I was required to add a property to an existing collection. The colleciton was generated on the WCF and was sent to a client. I was surprised to discover, that it's not supported and other people already faced this issue and expressed their frustration and posted different workarounds on the web. Unfortunately, none of these suggestions worked. So I decided to post a tested solution.&lt;br /&gt;&lt;br /&gt;So here is the situation, we have an Entity class and a collection of them:&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;span style="font-family:Courier New;font-size:85%;color:black;"&gt;  &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.ObjectModel;&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Runtime.Serialization;&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.&lt;span style="color:#2b91af;"&gt;Generic&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;  [DataContract]&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Entity&lt;br /&gt;  {&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; ID {&lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;;}&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; Name {&lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;;}&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  [CollectionDataContract]&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; EntityCollectionNotSupported : Collection&lt;entity&gt;&lt;br /&gt;  {&lt;br /&gt;    [DataMember]&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; AdditionalProperty { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;br /&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:gray;"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;span style="font-size:78%;color:gray;"&gt;Source Code Highlighter&lt;/span&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;It will compile, but will not serialize AdditionalProperty at all! So what can we do about it if EntitiesCollection must stay a Collection?&lt;br /&gt;&lt;br /&gt;We can mark our collection as DataContract and wrap another collection inside. Like this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;span style="font-family:Courier New;font-size:85%;color:black;"&gt;  [DataContract]&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; EntityCollectionWorkaround : ICollection&lt;entity&gt;&lt;br /&gt;  {&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; EntityCollectionWorkaround()&lt;br /&gt;    {&lt;br /&gt;      Entities = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&lt;entity&gt;();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    [DataMember]&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; AdditionalProperty { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;br /&gt;    [DataMember]&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&lt;entity&gt; Entities { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color:#008000;"&gt;// Implement here ICollection&lt;entity&gt;, &lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#008000;"&gt;// IEnumerable&lt;entity&gt; and IEnumerable members&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#008000;"&gt;// by wrapping Entities &lt;/span&gt;&lt;br /&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:gray;"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;span style="font-size:78%;color:gray;"&gt;Source Code Highlighter&lt;/span&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Hope it helped somebody&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-654016344971757696?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/654016344971757696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=654016344971757696' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/654016344971757696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/654016344971757696'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2009/04/wcf-collectiondatacontract-and.html' title='WCF CollectionDataContract and DataMember attributes'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-436219695575442624</id><published>2008-12-25T08:27:00.000-08:00</published><updated>2008-12-25T08:31:24.693-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>ORA-12154 when using EF Oracle Provider</title><content type='html'>When using &lt;a href="http://code.msdn.microsoft.com/EFOracleProvider"&gt;EFOracleProvider&lt;/a&gt;, ORA-12154 might occur if there are 2 Oracle clients installed on your machine. The problem is that EFOracleProvider is looking for for tnsnames.ora in client_2 folder instead of client_1. The workaround is copy tnsnames.ora to client_2 folder as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-436219695575442624?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/436219695575442624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=436219695575442624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/436219695575442624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/436219695575442624'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2008/12/ora-12154-when-using-ef-oracle-provider.html' title='ORA-12154 when using EF Oracle Provider'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-2922465361686234003</id><published>2008-12-11T02:22:00.000-08:00</published><updated>2008-12-11T02:23:14.624-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><title type='text'>Find stored procedures/functions that contain some text in SQL Server</title><content type='html'>&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt;&lt;font color="#0000ff"&gt;DECLARE&lt;/font&gt; @text &lt;font color="#0000ff"&gt;AS&lt;/font&gt; nvarchar(4000)&lt;br /&gt;&lt;font color="#0000ff"&gt;SET&lt;/font&gt; @text = &lt;font color="#A31515"&gt;'%text to find%'&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt; name, xtype &lt;font color="#0000ff"&gt;FROM&lt;/font&gt; sysobjects o&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;INNER&lt;/font&gt; &lt;font color="#0000ff"&gt;JOIN&lt;/font&gt; syscomments c &lt;font color="#0000ff"&gt;ON&lt;/font&gt; o.id = c.id&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;WHERE&lt;/font&gt; c.text &lt;font color="#0000ff"&gt;like&lt;/font&gt; @text&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-2922465361686234003?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/2922465361686234003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=2922465361686234003' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/2922465361686234003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/2922465361686234003'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2008/12/find-stored-proceduresfunctions-that.html' title='Find stored procedures/functions that contain some text in SQL Server'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-1300465705557768309</id><published>2008-12-11T02:20:00.000-08:00</published><updated>2008-12-11T02:21:01.652-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><title type='text'>Create CLR function in SQL Server 2005</title><content type='html'>&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt;&lt;font color="#008000"&gt;-- Drops existing aggregate function, remove this line if not needed&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;DROP&lt;/font&gt; &lt;font color="#0000ff"&gt;AGGREGATE&lt;/font&gt; StringConcat&lt;br /&gt;&lt;font color="#0000ff"&gt;GO&lt;/font&gt;&lt;br /&gt;&lt;font color="#008000"&gt;-- Drops existing assembly, remove this line if not needed&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;DROP&lt;/font&gt; ASSEMBLY SqlServerHelper &lt;br /&gt;&lt;font color="#0000ff"&gt;GO&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;CREATE&lt;/font&gt; ASSEMBLY SqlServerHelper &lt;font color="#0000ff"&gt;from&lt;/font&gt; &lt;font color="#A31515"&gt;'\\AssemblyPath\SqlServerHelper.dll'&lt;/font&gt; &lt;br /&gt;&lt;font color="#0000ff"&gt;WITH&lt;/font&gt; PERMISSION_SET = SAFE &lt;br /&gt;&lt;font color="#0000ff"&gt;GO&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;EXEC&lt;/font&gt; sp_configure &lt;font color="#A31515"&gt;'show advanced options'&lt;/font&gt; , &lt;font color="#A31515"&gt;'1'&lt;/font&gt;;&lt;br /&gt;&lt;font color="#0000ff"&gt;go&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;reconfigure&lt;/font&gt;;&lt;br /&gt;&lt;font color="#0000ff"&gt;go&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;EXEC&lt;/font&gt; sp_configure &lt;font color="#A31515"&gt;'clr enabled'&lt;/font&gt; , &lt;font color="#A31515"&gt;'1'&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;go&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;reconfigure&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;CREATE&lt;/font&gt; &lt;font color="#0000ff"&gt;AGGREGATE&lt;/font&gt; StringConcat (@&lt;font color="#0000ff"&gt;value&lt;/font&gt; &lt;font color="#0000ff"&gt;varchar&lt;/font&gt;(4000)) &lt;font color="#0000ff"&gt;RETURNS&lt;/font&gt; nvarchar(4000)&lt;br /&gt;&lt;font color="#0000ff"&gt;EXTERNAL&lt;/font&gt; NAME SqlServerHelper.Concatenate&lt;br /&gt;&lt;br /&gt;&lt;font color="#008000"&gt;-- Sample execution of CRL aggregate method&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;select&lt;/font&gt; &lt;font color="#0000ff"&gt;top&lt;/font&gt; 10 dbo.StringConcat(ExternalCode) &lt;br /&gt;&lt;font color="#0000ff"&gt;from&lt;/font&gt; decodeValues &lt;font color="#0000ff"&gt;group&lt;/font&gt; &lt;font color="#0000ff"&gt;by&lt;/font&gt; DirectionCode&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-1300465705557768309?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/1300465705557768309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=1300465705557768309' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/1300465705557768309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/1300465705557768309'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2008/12/create-clr-function-in-sql-server-2005.html' title='Create CLR function in SQL Server 2005'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-7564863034008563796</id><published>2008-12-11T02:13:00.000-08:00</published><updated>2008-12-11T02:15:07.766-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><title type='text'>Find foreign key of table in SQL Server</title><content type='html'>&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt;&lt;font color="#0000ff"&gt;DECLARE&lt;/font&gt; @ObjectName &lt;font color="#0000ff"&gt;varchar&lt;/font&gt;(50)&lt;br /&gt;&lt;font color="#0000ff"&gt;SET&lt;/font&gt; @ObjectName = &lt;font color="#A31515"&gt;'Customers'&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt; f.name &lt;font color="#0000ff"&gt;AS&lt;/font&gt; ForeignKey,&lt;br /&gt;&amp;nbsp; OBJECT_NAME(f.parent_object_id) &lt;font color="#0000ff"&gt;AS&lt;/font&gt; TableName,&lt;br /&gt;&amp;nbsp; COL_NAME(fc.parent_object_id, &lt;br /&gt;&amp;nbsp; fc.parent_column_id) &lt;font color="#0000ff"&gt;AS&lt;/font&gt; ColumnName,&lt;br /&gt;&amp;nbsp; OBJECT_NAME (f.referenced_object_id) &lt;font color="#0000ff"&gt;AS&lt;/font&gt; ReferenceTableName,&lt;br /&gt;&amp;nbsp; COL_NAME(fc.referenced_object_id, &lt;br /&gt;&amp;nbsp; fc.referenced_column_id) &lt;font color="#0000ff"&gt;AS&lt;/font&gt; ReferenceColumnName&lt;br /&gt;&lt;font color="#0000ff"&gt;FROM&lt;/font&gt; sys.foreign_keys &lt;font color="#0000ff"&gt;AS&lt;/font&gt; f&lt;br /&gt;&lt;font color="#0000ff"&gt;INNER&lt;/font&gt; &lt;font color="#0000ff"&gt;JOIN&lt;/font&gt; sys.foreign_key_columns &lt;font color="#0000ff"&gt;AS&lt;/font&gt; fc&lt;br /&gt;&amp;nbsp; &lt;font color="#0000ff"&gt;ON&lt;/font&gt; f.OBJECT_ID = fc.constraint_object_id&lt;br /&gt;&lt;font color="#0000ff"&gt;WHERE&lt;/font&gt; OBJECT_NAME(f.referenced_object_id)&amp;nbsp;= @ObjectName&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-7564863034008563796?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/7564863034008563796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=7564863034008563796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/7564863034008563796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/7564863034008563796'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2008/12/find-foreign-key-of-table-in-sql-server.html' title='Find foreign key of table in SQL Server'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-1752396023619931540</id><published>2008-10-28T08:37:00.000-07:00</published><updated>2008-10-28T09:17:51.130-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arithmetics'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='mathematics'/><category scheme='http://www.blogger.com/atom/ns#' term='GCD'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Euclidean'/><title type='text'>Non-recursive implementation of  Euclidean algorithm Greatest Common Divisor (C#)</title><content type='html'>We're familiar with Euclid's algorithm for finding greatest common divisor since from school, and implemented it for sure on basic programming classes. The below method does actually the same, but eliminates recursion (which is a bad thing) and does not uses any additional variables (which is a good thing). The function may look non-readable due to some tricks, but I hope the explanation below makes it clearer.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;font size="2" face="Courier New" color="black"&gt;&lt;ol&gt;&lt;li&gt;&lt;font color="#0000ff"&gt;uint&lt;/font&gt; NonRecursiveGCD(&lt;font color="#0000ff"&gt;uint&lt;/font&gt; a, &lt;font color="#0000ff"&gt;uint&lt;/font&gt; b)&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (a &lt; b)&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a += b;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b = a - b;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a -= b;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (b == 0) &lt;font color="#0000ff"&gt;return&lt;/font&gt; a;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;while&lt;/font&gt; ( a % b != 0 )&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a += b;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b = a - b;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a -= b;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b %= a;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;return&lt;/font&gt; b;&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;/font&gt;&lt;/ol&gt;&lt;font size="1" color="gray"&gt;* This source code was highlighted with &lt;a href="http://virtser.net/blog/post/source-code-highlighter.aspx"&gt;&lt;font size="1" color="gray"&gt;Source Code Highlighter&lt;/font&gt;&lt;/a&gt;.&lt;/font&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Lines 3-8 ensure that "a" is bigger than "b" and exchange them otherwise using a well known trick for exchanging variables without additional memory.&lt;br /&gt;&lt;br /&gt;Line 10 takes care for case GCD(a,0), and returns "a" as the GCD.&lt;br /&gt;&lt;br /&gt;The "while" loop in lines 12-18 actually implements the Euclid's algorithm by finding remainder of "a" and "b", then puts "b" into "a" and the remainder into "b". &lt;br /&gt;&lt;br /&gt;Lines 14-16 use again the "swap" trick for exchanging variables without additional memory usage.&lt;br /&gt;&lt;br /&gt;Line 19 returns the last remainder, which is also the GCD to the caller.&lt;br /&gt;&lt;br /&gt;Any comments and suggestions are welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-1752396023619931540?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/1752396023619931540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=1752396023619931540' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/1752396023619931540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/1752396023619931540'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2008/10/non-recursive-implementation-of.html' title='Non-recursive implementation of  Euclidean algorithm Greatest Common Divisor (C#)'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-3396934834951508572</id><published>2008-07-17T07:34:00.000-07:00</published><updated>2008-07-17T07:36:03.453-07:00</updated><title type='text'>NUnit Serialization Test</title><content type='html'>NUnit test that verifies that your class is fully serializable and desializable:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;font size="2" face="Courier New" color="black"&gt;[Test]&lt;br&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; SerializationTest()&lt;br&gt;{&lt;br&gt;&amp;nbsp;MyGenericCollection myCollection = &lt;font color="#0000ff"&gt;new&lt;/font&gt; MyGenericCollection();&lt;br&gt;&amp;nbsp;SerializationHelper.SerializeNow(myCollection);&lt;br&gt;&amp;nbsp;myCollection = (MyGenericCollection)SerializationHelper.DeSerializeNow();&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;internal&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; SerializationHelper&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;private&lt;/font&gt; &lt;font color="#0000ff"&gt;static&lt;/font&gt; &lt;font color="#0000ff"&gt;readonly&lt;/font&gt; &lt;font color="#0000ff"&gt;string&lt;/font&gt; DefaultFilePath = &lt;font color="#A31515"&gt;"test.dat"&lt;/font&gt;;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;internal&lt;/font&gt; &lt;font color="#0000ff"&gt;static&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; SerializeNow(&lt;font color="#0000ff"&gt;object&lt;/font&gt; c)&lt;br&gt;&amp;nbsp;&amp;nbsp;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SerializeNow(c, DefaultFilePath);&lt;br&gt;&amp;nbsp;&amp;nbsp;}&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;internal&lt;/font&gt; &lt;font color="#0000ff"&gt;static&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; SerializeNow(&lt;font color="#0000ff"&gt;object&lt;/font&gt; c, &lt;font color="#0000ff"&gt;string&lt;/font&gt; filepath)&lt;br&gt;&amp;nbsp;&amp;nbsp;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;FileInfo f = &lt;font color="#0000ff"&gt;new&lt;/font&gt; FileInfo(filepath);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;using&lt;/font&gt; (&lt;font color="#2B91AF"&gt;Stream&lt;/font&gt; s = f.Open(&lt;font color="#2B91AF"&gt;FileMode&lt;/font&gt;.Create))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;BinaryFormatter b = &lt;font color="#0000ff"&gt;new&lt;/font&gt; BinaryFormatter();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b.Serialize(s, c);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;&amp;nbsp;&amp;nbsp;}&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;internal&lt;/font&gt; &lt;font color="#0000ff"&gt;static&lt;/font&gt; &lt;font color="#0000ff"&gt;object&lt;/font&gt; DeSerializeNow()&lt;br&gt;&amp;nbsp;&amp;nbsp;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;return&lt;/font&gt; DeSerializeNow(DefaultFilePath);&lt;br&gt;&amp;nbsp;&amp;nbsp;}&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;internal&lt;/font&gt; &lt;font color="#0000ff"&gt;static&lt;/font&gt; &lt;font color="#0000ff"&gt;object&lt;/font&gt; DeSerializeNow(&lt;font color="#0000ff"&gt;string&lt;/font&gt; filepath)&lt;br&gt;&amp;nbsp;&amp;nbsp;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileInfo f = &lt;font color="#0000ff"&gt;new&lt;/font&gt; FileInfo(filepath);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;using&lt;/font&gt; (&lt;font color="#2B91AF"&gt;Stream&lt;/font&gt; s = f.Open(&lt;font color="#2B91AF"&gt;FileMode&lt;/font&gt;.Open))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BinaryFormatter b = &lt;font color="#0000ff"&gt;new&lt;/font&gt; BinaryFormatter();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;return&lt;/font&gt; b.Deserialize(s);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;}&lt;br&gt;}&lt;/font&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-3396934834951508572?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/3396934834951508572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=3396934834951508572' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/3396934834951508572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/3396934834951508572'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2008/07/nunit-serialization-test.html' title='NUnit Serialization Test'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3090991703190749969.post-3646599196784300455</id><published>2008-07-17T06:54:00.000-07:00</published><updated>2008-07-17T07:02:01.834-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BizTalk'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='exception'/><category scheme='http://www.blogger.com/atom/ns#' term='Generics'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='deserialization'/><title type='text'>"The constructor to deserialize an object of type 'MyGenericCollection' was not found."</title><content type='html'>This exception is thrown by an application that tries to deserialize an instance of MyGenericCollection. In my case it was thrown by BizTalk that stores current state of it variables by their serialization and saving into its database. Then it restores the previous state by deserialization.&lt;br /&gt;MyGenericCollection is a class that derives from Dictionary&amp;lt;Key,value&amp;gt;, which is serializable.&lt;br /&gt;&lt;br /&gt;So why the deserialization failed?&lt;br /&gt;Because the deserialization is done within constructor which accepts SerializationInfo and StreamingContext, but constructors are not derived. It means that we need to to define such constructor:&lt;br /&gt;&lt;br /&gt;public class MyGenericCollection : Dictionary&amp;lt;Key,Value&amp;gt;&lt;br /&gt;{&lt;br /&gt;protected MyGenericCollection(SerializationInfo info, StreamingContext context)&lt;br /&gt;: base(info, context) { }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3090991703190749969-3646599196784300455?l=borismod.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://borismod.blogspot.com/feeds/3646599196784300455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3090991703190749969&amp;postID=3646599196784300455' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/3646599196784300455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3090991703190749969/posts/default/3646599196784300455'/><link rel='alternate' type='text/html' href='http://borismod.blogspot.com/2008/07/constructor-to-deserialize-object-of.html' title='&quot;The constructor to deserialize an object of type &apos;MyGenericCollection&apos; was not found.&quot;'/><author><name>Boris Modylevsky</name><uri>http://www.blogger.com/profile/13864094556362517427</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
