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

<channel>
	<title>c# Archives - Dragonsoft Technology View</title>
	<atom:link href="https://blog.dragonsoft.us/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.dragonsoft.us/tag/c/</link>
	<description>Talk about Technologies, Software Architecture and Management</description>
	<lastBuildDate>Wed, 26 May 2021 03:17:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.dragonsoft.us/wp-content/uploads/2022/04/logo-main-bw-150x150.png</url>
	<title>c# Archives - Dragonsoft Technology View</title>
	<link>https://blog.dragonsoft.us/tag/c/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">2577970</site>	<item>
		<title>How to set default file name for export from CrystalReportViewer in ASP.Net</title>
		<link>https://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/</link>
					<comments>https://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/#comments</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Tue, 07 Apr 2009 20:20:57 +0000</pubDate>
				<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[crystalreportviewer]]></category>
		<category><![CDATA[set default export file name]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=921</guid>

					<description><![CDATA[<p>I have had nice discussion about a new Crystal Reports based web-site today. And everything seems to be fine&#8230; Except users want to see a proper default name for the exported files&#8230; Environment: Crystal Reports 2008 engine IIS 7 ASP.Net 3.0 page with CrystalReportViewer (CRV) being used to show report<a class="moretag" href="https://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/"> Read more</a></p>
<p>The post <a href="https://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/">How to set default file name for export from CrystalReportViewer in ASP.Net</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I have had nice discussion about a new Crystal Reports based web-site today. And everything seems to be fine&#8230; Except users want to see a proper default name for the exported files&#8230;</p>
<p>Environment:</p>
<ul>
<li>Crystal Reports 2008 engine</li>
<li>IIS 7</li>
<li>ASP.Net 3.0 page with CrystalReportViewer (CRV) being used to show report passed by parameter</li>
</ul>
<p>When trying export as PDF (just an example), CRV defaults the name of the file to <em>CrystalReportViewer1.pdf.<br />
</em>Not very nice since associated RPT name is <em>MyVeryOwnReport.rpt</em> and I have many other which I would expect export file at least inherit.</p>
<p>One would expect that Viewer would have a property allowing specify default export name. Not so fast&#8230; there is no such thing today exists.</p>
<p>After some head scratching and research, it just happen that Default Export File Name is actually based of the ID property value of the CRV which is still named as CrystalReportViewer1.</p>
<p>Options?</p>
<ol>
<li>Rename ID value of the control as something else. Still, if we use just one page and load reports dynamically, then it would not help much.
<pre class="brush: csharp; title: ; notranslate">// ReportPreview.aspx file
&lt;CR:CrystalReportViewer ID=&quot;MyVeryOwnExportFile&quot; /&gt;</pre>
</li>
<li>Another option is to populate Default Export file name in the code
<pre class="brush: csharp; title: ; notranslate">// ReportPreview.aspx.cs file
protected void Page_Init(object sender, EventArgs e)
{
     ...
    // Load report here
    ...
    CrystalReportViewer1.ID = &quot;MyVeryOwnExportFile&quot;;
}</pre>
<p>It is important to have it set before any code would use it to manipulate a page view state and create references.</p>
</li>
<li>Trying <a href="http://msdn.microsoft.com/en-us/library/aa288404(VS.71).aspx" target="_blank">manually set export options</a> for the Report instance, would not help much unfortunately since viewer would disregard it.</li>
<li>Off course there is always an option of coding export functionality yourself and bypass built-in logic&#8230;</li>
</ol>
<p>This concludes another Crystal Reports dance session.</p>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/">How to set default file name for export from CrystalReportViewer in ASP.Net</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">921</post-id>	</item>
		<item>
		<title>File locks or when garbage collection goes bad</title>
		<link>https://blog.dragonsoft.us/2009/03/02/file-locks-or-when-garbage-collection-goes-bad/</link>
					<comments>https://blog.dragonsoft.us/2009/03/02/file-locks-or-when-garbage-collection-goes-bad/#respond</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Mon, 02 Mar 2009 12:23:41 +0000</pubDate>
				<category><![CDATA[Fun stuff with C#]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[cannot delete file]]></category>
		<category><![CDATA[file lock]]></category>
		<category><![CDATA[garbage collection manager]]></category>
		<category><![CDATA[manage garbage collection process]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=842</guid>

					<description><![CDATA[<p>With introduction of garbage collection (System.GC name space) in .Net, life of the Windows programmer become easy &#8211; no need to worry about releasing objects, code become simpler, etc. In &#8220;old&#8221; time one would need to use Interfaces to achieve similar functionality and it does have some advantage even over GC &#8211;<a class="moretag" href="https://blog.dragonsoft.us/2009/03/02/file-locks-or-when-garbage-collection-goes-bad/"> Read more</a></p>
<p>The post <a href="https://blog.dragonsoft.us/2009/03/02/file-locks-or-when-garbage-collection-goes-bad/">File locks or when garbage collection goes bad</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>With introduction of <a href="http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)" target="_blank">garbage collection</a> (System.GC name space) in .Net, life of the Windows programmer become easy &#8211; no need to worry about releasing objects, code become simpler, etc.<br />
In &#8220;old&#8221; time one would need to use Interfaces to achieve similar functionality and it does have some advantage even over GC &#8211; immediate garbage collection or release of allocated resources/objects.</p>
<p>When writing code in .Net some of us take many things for granted and not always keep in mind that many operations are performed in the context of the unmanaged code or in the &#8220;old way&#8221;&#8230;</p>
<p>File operations or legacy code wrappers are perfect example.<br />
Just because library is available as managed code, it does not mean that everything has ability to &#8220;self-heal&#8221;.<br />
For example in code file is open for edit with lock being placed.<br />
If the file in not closed explicitly, it would be a responsibility of the owner process to release the lock at the time of releasing associated resources &#8211; when process is destroyed.</p>
<p>With garbage collection, just because we are no longer using/owning the process/object, it does not mean that it has been destroyed immediately after. GC management core will release object when it &#8220;feels&#8221; fit, therefore introducing latency into the process.</p>
<p>Off course, proper way would be to be more careful within the code and make sure any locks are released in managed and predictable way: Open/Close, Lock/Unlock, &#8230; Easy solution, but not always accessible, especially when working with 3rd party libraries.</p>
<p>So instead, we can force GC manager to &#8220;collect garbage&#8221; in-place with the following small code:</p>
<pre class="brush: csharp; title: ; notranslate">// See code follow up below
System.GC.Collect();
System.GC.WaitForPendingFinalizers();</pre>
<p>What does it do?<br />
First call will instruct GC manager to start the process (<a href="http://msdn.microsoft.com/en-us/library/system.gc.collect.aspx" target="_blank">1</a>), while second (<a href="http://msdn.microsoft.com/en-us/library/system.gc.waitforpendingfinalizers.aspx" target="_blank">2</a>) will make sure that we wait for process to be completed.</p>
<p>In the case of the file locks, only after GC has released process which placed the lock in the first place, we can manipulate with the file (ex. delete, rename, move).</p>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2009/03/02/file-locks-or-when-garbage-collection-goes-bad/">File locks or when garbage collection goes bad</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2009/03/02/file-locks-or-when-garbage-collection-goes-bad/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">842</post-id>	</item>
		<item>
		<title>Assert is your friend&#8230; not an end-user&#8217;s</title>
		<link>https://blog.dragonsoft.us/2009/01/15/assert-is-your-friend-not-end-users/</link>
					<comments>https://blog.dragonsoft.us/2009/01/15/assert-is-your-friend-not-end-users/#respond</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Thu, 15 Jan 2009 22:24:22 +0000</pubDate>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Fun stuff with C#]]></category>
		<category><![CDATA[.net 3.5]]></category>
		<category><![CDATA[assert]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[debug.assert]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[trace.assert]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=777</guid>

					<description><![CDATA[<p>As a long time Delphi and C# programmer one become used to some features of the language and may not go deep into &#8220;philosophical&#8221; thinking about such features. This often happen with Asserts&#8230; What is Assert or Assertion? By its definition Assert: state categorically affirm: to declare or affirm solemnly<a class="moretag" href="https://blog.dragonsoft.us/2009/01/15/assert-is-your-friend-not-end-users/"> Read more</a></p>
<p>The post <a href="https://blog.dragonsoft.us/2009/01/15/assert-is-your-friend-not-end-users/">Assert is your friend&#8230; not an end-user&#8217;s</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>As a long time Delphi and C# programmer one become used to some features of the language and may not go deep into &#8220;philosophical&#8221; thinking about such features. This often happen with <strong>Asserts</strong>&#8230;</p>
<h3>What is Assert or Assertion?</h3>
<p>By its definition <strong>Assert</strong>:</p>
<ul>
<li>state categorically</li>
<li>affirm: to declare or affirm solemnly and formally as true</li>
<li>insist: assert to be true</li>
<li>In Computing (<a href="http://en.wikipedia.org/wiki/Assert" target="_blank">wiki</a>): &#8220;an <strong>assert</strong> is a predicate (i.e., a true–false statement) placed in a program to indicate that the developer <em>thinks</em> that the predicate is always true at that place&#8221;</li>
</ul>
<p>In general, using <strong>assert</strong> in the code proven to be useful in many situations because it &#8220;<a href="http://msdn.microsoft.com/en-us/library/aa326827.aspx" target="_blank">checks for a condition and outputs the call stack if the condition is <strong>false</strong></a>&#8221; and it could help to debug some strange situations in the code.</p>
<h3><a href="http://www.codeproject.com/KB/cpp/assertisyourfriend.aspx" target="_blank">Assert is your friend</a></h3>
<p>This method is for programmers to use. But what happen often when something is convenient, it started to be used excessively. Why it is happening?</p>
<p>Let&#8217;s look at the declaration of <strong>Assert</strong> in C# (3.x). There are two versions of the <strong>Assert()</strong>: <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.debug.assert.aspx" target="_blank"><strong>Debug.Assert()</strong></a> and <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.trace.assert.aspx" target="_blank"><strong>Trace.Assert()</strong></a>, both in <strong>System.Diagnostics </strong>namespace.</p>
<pre class="brush: csharp; title: ; notranslate">
// Checks for a condition and outputs the call stack
// if the condition is false

&#x5B;ConditionalAttribute(&quot;TRACE&quot;)]
public static void Assert(bool condition)

&#x5B;ConditionalAttribute(&quot;TRACE&quot;)]
public static void Assert(bool condition, string message)

&#x5B;ConditionalAttribute(&quot;DEBUG&quot;)]
public static void Assert(bool condition)

&#x5B;ConditionalAttribute(&quot;DEBUG&quot;)]
public static void Assert(bool condition, string message)</pre>
<p>As we can see from above code, Assert is to be used for <span style="text-decoration: underline;">Testing</span> and <span style="text-decoration: underline;">Debugging</span> and therefore should not be used as a way to present any information to the <strong>end-user.</strong></p>
<h3>Helping yourself</h3>
<p>As useful as it seems, even then Assert infrastructure may not be used to full extend. In the sample declarations above we can see that logic can be invoked with and without providing any additional information.<br />
Imagine how useful is a message &#8220;Project raised an Assert in line X&#8221; compare to &#8220;Project raised an Assert with the Message in line X&#8221;.<br />
First option gives you idea where something failed, where second actually tells you what went wrongand where. Let&#8217;s use power of the tool-set and provide ourselves with useful information.</p>
<h3>Assert is NOT for an end-user</h3>
<p>I was asked recently (this seems to be a ongoing discussion) &#8211; &#8220;Why a programmer should not be using asserts as a regular approach in code conditions validation even when it comes to a production code?&#8221;</p>
<p>By default, Assert would show a message box with some information and the current Call Stack. This information, while being helpful to the developer, would not tell much to the user.</p>
<p>With custom <span><a id="ctl00_rs1_mainContentContainer_ctl73" onclick="function onclick() { function onclick() { function onclick() { function onclick() { Track('ctl00_rs1_mainContentContainer_cpe285485_c|ctl00_rs1_mainContentContainer_ctl73',this); } } } }" href="http://msdn.microsoft.com/en-us/library/system.diagnostics.tracelistener.aspx"><span style="color: #0033cc;">TraceListener</span></a></span> introduced, message can be hidden from the user and information could be stored, but it is not how it should be used by definition.</p>
<p>If information is expected to be presented to the user in any form, it could be achieved in a form not an exceptional, intended for debugging, situation, but by using regular methods: message box, application log, Windows event log, etc.<br />
Even in the case of component development it is desired to use exceptions (<strong>raise/throw</strong>) to &#8220;bubble&#8221; proper message to the error handling layer.</p>
<blockquote><p>The <span><span class="input">throw</span></span> statement is used to signal the occurrence of an anomalous situation (exception) during the program execution.</p></blockquote>
<h3>Assert is a conditional logic</h3>
<p>Last, final and probably major concern here is that in Release environment Debug and even Trace functionality would be disabled and therefore, any code/logic which depend on Assert() would be suppressed and all the nice validations became worthless (see declaration above)&#8230; and Access Violation errors starting pop up unexpectedly.</p>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2009/01/15/assert-is-your-friend-not-end-users/">Assert is your friend&#8230; not an end-user&#8217;s</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2009/01/15/assert-is-your-friend-not-end-users/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">777</post-id>	</item>
		<item>
		<title>ASP.Net/WF : New built-in .Net Charting control</title>
		<link>https://blog.dragonsoft.us/2008/11/26/aspnet-new-build-in-net-charting-control/</link>
					<comments>https://blog.dragonsoft.us/2008/11/26/aspnet-new-build-in-net-charting-control/#comments</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Wed, 26 Nov 2008 18:14:38 +0000</pubDate>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Fun stuff with C#]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web-design]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[asp:chart]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[chart support in .Net]]></category>
		<category><![CDATA[charting]]></category>
		<category><![CDATA[Dundas]]></category>
		<category><![CDATA[winforms]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=620</guid>

					<description><![CDATA[<p>I was always for a &#8220;built-in&#8221; support of features in modern development environment. Even if it comes in basic form, we, as programmers, should have ability to do &#8220;basic&#8221; stuff without 3rd party involvement. There are plenty of 3rd party solutions on the market which would help you include some kind<a class="moretag" href="https://blog.dragonsoft.us/2008/11/26/aspnet-new-build-in-net-charting-control/"> Read more</a></p>
<p>The post <a href="https://blog.dragonsoft.us/2008/11/26/aspnet-new-build-in-net-charting-control/">ASP.Net/WF : New built-in .Net Charting control</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I was always for a &#8220;built-in&#8221; support of features in modern development environment. Even if it comes in basic form, we, as programmers, should have ability to do &#8220;basic&#8221; stuff without 3rd party involvement.</p>
<p>There are plenty of 3rd party solutions on the market which would help you include some kind of charting support with your ASP pages and WinForms applications &#8211; <a href="http://www.softwarefx.com/sfxNetProducts/ChartFX/wpf/" target="_blank" rel="noopener">ChartFX</a>, <a href="http://www.dundas.com/Products/Chart/NET/index.aspx" target="_blank" rel="noopener">Dundas Chart</a> &#8211; these are just few from many available on the market today.</p>
<p>As it turned out, Microsoft has decided to add out-of-the-box support for Charting as well &#8211; <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c&amp;DisplayLang=en" target="_blank" rel="noopener">&lt;asp:chart runat=&#8221;server&#8221;/&gt;</a>.<br />
Read about it here &#8211; <a href="http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx" target="_blank" rel="noopener">New ASP.NET Charting Control: &lt;asp:chart runat=&#8221;server&#8221;/&gt;</a> by Scott Guthrie &#8211; everything you need to know about the .Net 3.5 framework new addition.</p>
<p>For  additional information also visit Alex Gorev&#8217;s <a href="http://blogs.msdn.com/alexgor/archive/2008/11/07/microsoft-chart-control-vs-dundas-chart-control.aspx" target="_blank" rel="noopener">blog</a>.</p>
<p><strong>Note 1</strong>: Even though caption says it is ASP.Net solution, in the original you would find link to WinForms sample as well.<br />
<strong>Note 2</strong>: Do not worry about Dundas copyright &#8211; &#8220;Microsoft acquired Dundas Data Visualization Intellectual Property in April 2007.&#8221;</p>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2008/11/26/aspnet-new-build-in-net-charting-control/">ASP.Net/WF : New built-in .Net Charting control</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2008/11/26/aspnet-new-build-in-net-charting-control/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">620</post-id>	</item>
		<item>
		<title>Tip: Get report parameters as text from Crystal Reports in C#</title>
		<link>https://blog.dragonsoft.us/2008/10/31/tip-get-report-parameters-as-text-from-crystal-reports-in-c/</link>
					<comments>https://blog.dragonsoft.us/2008/10/31/tip-get-report-parameters-as-text-from-crystal-reports-in-c/#respond</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Fri, 31 Oct 2008 15:12:36 +0000</pubDate>
				<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[get parameters as text]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=563</guid>

					<description><![CDATA[<p>I am starting a new set of posts presenting small code snippets in C# you could use when working with Crystal Reports in Visual Studio. And the first one is &#8220;GetReportParamsAsText&#8220;. Very simple but very handy function which allows to include report parameters values in your ASP.Net page without actually<a class="moretag" href="https://blog.dragonsoft.us/2008/10/31/tip-get-report-parameters-as-text-from-crystal-reports-in-c/"> Read more</a></p>
<p>The post <a href="https://blog.dragonsoft.us/2008/10/31/tip-get-report-parameters-as-text-from-crystal-reports-in-c/">Tip: Get report parameters as text from Crystal Reports in C#</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I am starting a new set of posts presenting small code snippets in C# you could use when working with Crystal Reports in Visual Studio.</p>
<p>And the first one is &#8220;<strong>GetReportParamsAsText</strong>&#8220;. Very simple but very handy function which allows to include report parameters values in your ASP.Net page without actually displaying the report.<br />
This version works only with Discrete Value parameters. </p>
<pre class="brush: csharp; title: ; notranslate">/// Function returns list of paramaters descriptions with
/// associated values for specified report
public string GetReportParamsAsText(ReportDocument reportDocument)
{
    if (reportDocument == null) return &quot;Report not specified&quot;;

    string result = &quot;&quot;;
    string description;
    string valueText;
    ParameterDiscreteValue value;

    foreach (ParameterFieldDefinition prm
                  in reportDocument.DataDefinition.ParameterFields)
    {
        try
        {
            if (prm.CurrentValues.IsNoValue) continue;

            if (prm.CurrentValues&#x5B;0] is ParameterDiscreteValue)
            {
                value = (ParameterDiscreteValue)prm.CurrentValues&#x5B;0];
                if (description.StartsWith(&quot;Enter &quot;))
                {
                    description = description.Remove(0, 6);
                }
                valueText = value.Value.ToString();
            }
            else
            {
                valueText = &quot;&#x5B;not supported param type]&quot;;
            }

            result += &quot;&lt;strong&gt;&quot; + description + &quot;&lt;/strong&gt; &quot; + valueText + &quot;
&quot;;
        }
        catch
        {
            // Ignore any errors
        }
    }
    return result;
}</pre>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2008/10/31/tip-get-report-parameters-as-text-from-crystal-reports-in-c/">Tip: Get report parameters as text from Crystal Reports in C#</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2008/10/31/tip-get-report-parameters-as-text-from-crystal-reports-in-c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">563</post-id>	</item>
		<item>
		<title>Populate TreeView from table in ASP.Net</title>
		<link>https://blog.dragonsoft.us/2008/10/28/populate-treeview-from-table-in-aspnet/</link>
					<comments>https://blog.dragonsoft.us/2008/10/28/populate-treeview-from-table-in-aspnet/#comments</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Tue, 28 Oct 2008 21:49:51 +0000</pubDate>
				<category><![CDATA[Fun stuff with C#]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[populate treeview from table]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=545</guid>

					<description><![CDATA[<p>I was asked today to help with code which would populate the TreeView control from database table in ASP.Net page. Since it is not a first time around and appear to be very common situation with dynamic pages, I thought it may be useful to write about it once and<a class="moretag" href="https://blog.dragonsoft.us/2008/10/28/populate-treeview-from-table-in-aspnet/"> Read more</a></p>
<p>The post <a href="https://blog.dragonsoft.us/2008/10/28/populate-treeview-from-table-in-aspnet/">Populate TreeView from table in ASP.Net</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I was asked today to help with code which would populate the TreeView control from database table in ASP.Net page.</p>
<p>Since it is not a first time around and appear to be very common situation with dynamic pages, I thought it may be useful to write about it once and then just refer to this post later.</p>
<ol>
<li>We have a table with the following structure:<br />
<table border="1">
<tbody>
<tr>
<td>ID</td>
<td>ParentID</td>
<td>Name</td>
</tr>
</tbody>
</table>
</li>
<li>We also have a stored procedure <strong>usp_GetGroupList</strong> which would return data from table above.</li>
<li>And on our ASP page we have a TreeView control called myTreeView</li>
</ol>
<p>Few things we are trying to achieve:</p>
<ol>
<li>Small code</li>
<li>Minimum of database access</li>
</ol>
<p>Well, code would not be too complex after all:</p>
<pre class="brush: csharp; title: ; notranslate">private void PopulateTree()
{
    // Populate dataset with data for later use
    DataSet dsList = new DataSet();
    SqlConnection conn = new SqlConnection(myConnectionString);
    conn.Open();
    try
    {
        SqlCommand cmd = new SqlCommand(&quot;usp_GetGroupList&quot;, conn);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter adapt = new SqlDataAdapter(cmd);
        adapt.Fill(dsList);
    }
    finally
    {
        conn.Close();
    }

    // Clear the tree
    myTreeView.Nodes.Clear();
    PopulateTreeNode(dsList, null, &quot;0&quot;);
}

private void PopulateTreeNode(DataSet dsList, TreeNode parent, string parentID)
{
    TreeNodeCollection baseNodes;
    string rowID;
    TreeNode node;

    if (parent == null)
    {
        baseNodes = myTreeView.Nodes;
    }
    else
    {
        baseNodes = parent.ChildNodes;
    }

    foreach (DataRow dsRow in dsList.Tables&#x5B;0].Select(&quot;ParentID = &quot; + parentID))
    {
        node = new TreeNode();
        node.Text = dsRow&#x5B;&quot;Name&quot;].ToString();
        rowID = dsRow&#x5B;&quot;ID&quot;].ToString();
        node.Value = rowID;
        node.SelectAction = TreeNodeSelectAction.Select;

        // Add link back to itself so selected group could be changed
        node.NavigateUrl = &quot;~/default.aspx?id=&quot; + rowID;
        baseNodes.Add(node);

        // Use recusion to populate child nodes
        PopulateTreeNode(dsList, node, rowID);

        // Preselect the node for current group
        if (node.Value == Request.QueryString&#x5B;&quot;id&quot;])
        {
            node.Selected = true;
        }
    }
}
</pre>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2008/10/28/populate-treeview-from-table-in-aspnet/">Populate TreeView from table in ASP.Net</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2008/10/28/populate-treeview-from-table-in-aspnet/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">545</post-id>	</item>
		<item>
		<title>Delphi, methods and default values. Convenience or contract enforcement?</title>
		<link>https://blog.dragonsoft.us/2008/08/28/delphi-methods-and-default-values-convenience-or-contract-enforcement/</link>
					<comments>https://blog.dragonsoft.us/2008/08/28/delphi-methods-and-default-values-convenience-or-contract-enforcement/#comments</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Thu, 28 Aug 2008 14:28:50 +0000</pubDate>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[default parameter]]></category>
		<category><![CDATA[default value]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[dry principle]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=324</guid>

					<description><![CDATA[<p>Delphi, methods and default values. Being somewhat unique in methods declaration for the classes, Delphi requires you to have proper method parameters declaration, but: You do not have to have any default values for the parameters being propagated into implementation section for the method. And you do not have to have any parameters<a class="moretag" href="https://blog.dragonsoft.us/2008/08/28/delphi-methods-and-default-values-convenience-or-contract-enforcement/"> Read more</a></p>
<p>The post <a href="https://blog.dragonsoft.us/2008/08/28/delphi-methods-and-default-values-convenience-or-contract-enforcement/">Delphi, methods and default values. Convenience or contract enforcement?</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Delphi, methods and default values.</p>
<p>Being somewhat unique in methods declaration for the classes, Delphi requires you to have proper method parameters declaration, but:</p>
<ol>
<li>You do not have to have any default values for the parameters being propagated into implementation section for the method.</li>
<li>And you do not have to have any parameters being specified in implementation section at all.</li>
<li>If your class implements an interface, then while order and type of parameters remain unchanged for the interface method implemented, compiler would not not even detect it.</li>
<li>When declaring the method and then using code complete feature of the IDE, stub generated would have all parameters but no default values.</li>
<li>Declaration of the parameters could be &#8220;optimized&#8221; by changing the way they are grouped if they are of the same type. And sync is not enforced between declaration and implementation.</li>
</ol>
<p>Convenient. Nice. Easy.</p>
<p>Again, it is convenient since it does not force you to propagate your changes between two if you are to change your default values.</p>
<p>Is default value good or evil?</p>
<p>Well, Microsoft saying <a href="http://blogs.msdn.com/csharpfaq/archive/2004/03/07/85556.aspx" target="_blank">it is specific to an implementation of the language</a> (C#) and suggests to use overloads instead. Yes, it can be done, but defaults were introduced for a reason. And, in fact, some compilers, even Delphi, would be confused with overloaded declaration if there is a slight chance of mixing two.</p>
<p><span id="more-324"></span></p>
<p>Back in 2005, <a href="http://forums.msdn.microsoft.com/en-US/netfxbcl/thread/e276babe-248b-4e36-b8d0-1e2796d4954a/" target="_blank">dflat</a> wrote:</p>
<blockquote><p>Disadvantage:<br />
1. A bit tedious to call, because even if you don&#8217;t put any actual parameters, you have to write down all the types.</p>
<p>Advantages:<br />
1. Unlike C++ default params, this allows all combinations<br />
2. No signature conflict or ambiguity. The whole signature is matched when calling a method with default parameters, because type must be specified if the parameter is missing.<br />
3. No run-time overhead, because everything can be determined at compile time.</p>
<p>Feasibility. I don&#8217;t think it&#8217;s difficult to implement (in later version of  C#) because:<br />
1. No additional key word is introduced. &#8220;default&#8221; is already a key word in C#<br />
2. No ambiguity. It doesn&#8217;t conflict with any existing C# language semantics</p></blockquote>
<p>I may sound old fashioned, but I prefer propagate declaration of the method into implementation, because:</p>
<ol>
<li>if for any reason you have to move things around the code, it is convenient to be able grab implemtation of the methoid and easily reusing it in declaration of another class.</li>
<li>while reading the code, be able to see exact calling contract for the function you are investigating without a need to jump between declaration and implemtation.</li>
<li>also having it in sync, force you to review the code when any default values are changed and if you are using something like XMLDoc/JavaDoc/PasDoc, compiler will force you review your method documentation.</li>
</ol>
<p>Yes, it &#8220;breaks&#8221; a &#8220;<a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself" target="_self">Dry code</a>&#8221; principle. But it is not more of &#8220;dryness&#8221; with that approach then not having any parameters in implemtation section of the method. And while it &#8220;polutes&#8221; the code, it adds more self-documenting and readability to it.</p>
<p>What are yours points &#8220;for&#8221; and &#8220;against&#8221; default parameters and use of them?</p>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2008/08/28/delphi-methods-and-default-values-convenience-or-contract-enforcement/">Delphi, methods and default values. Convenience or contract enforcement?</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2008/08/28/delphi-methods-and-default-values-convenience-or-contract-enforcement/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">324</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Minified using Disk
Database Caching 15/85 queries in 0.051 seconds using Disk

Served from: blog.dragonsoft.us @ 2026-05-12 12:52:49 by W3 Total Cache
-->