<?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>FlexiCoder Blog &#187; C# 3.5</title>
	<atom:link href="http://www.flexicoder.com/blog/index.php/category/c-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexicoder.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 28 Jul 2010 15:11:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XSL/T Transform from String to String</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/07/xslt-transform-from-string-to-string/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/07/xslt-transform-from-string-to-string/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 09:01:19 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[.Net code]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XSL/T]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=185</guid>
		<description><![CDATA[The following example transforms the supplied xml string, using XSL/T and outputs to another string


using (StringReader rdr = new StringReader(selectedLine.AdditionalInformation))
{
    XPathDocument doc = new XPathDocument(rdr);

    using (StringWriter writer = new StringWriter())
    {

        transformer.Transform(doc, null, writer);
     [...]]]></description>
			<content:encoded><![CDATA[<p>The following example transforms the supplied xml string, using XSL/T and outputs to another string<br />
<code></p>
<pre class="brush:c#">
using (StringReader rdr = new StringReader(selectedLine.AdditionalInformation))
{
    XPathDocument doc = new XPathDocument(rdr);

    using (StringWriter writer = new StringWriter())
    {

        transformer.Transform(doc, null, writer);
        titleLabel.Attributes.Add("onmouseover", string.Format(@"showDiv(""{0}"")", writer.ToString()));
    }
}
</pre>
<p></code><br />
The XSL/T loaded into the <em>transformer</em> variable is as follows<br />
<code>
<pre class="brush:xml">
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
    <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>

        <xsl:template match="/">
<xsl:text>&lt;table class='panelTable'&gt;</xsl:text><xsl:apply-templates select="//Order"></xsl:apply-templates><xsl:text>&lt;/table&gt;</xsl:text>
        </xsl:template>
        <xsl:template match="Order">
<xsl:text>&lt;tr&gt;&lt;td colspan='2' class='TitlePanelHeader'&gt;</xsl:text><xsl:value-of select="@title"></xsl:value-of><xsl:text>&lt;/td&gt;&lt;/tr&gt;</xsl:text><xsl:apply-templates select="Info"></xsl:apply-templates>
        </xsl:template>
        <xsl:template match="Info">
<xsl:text>&lt;tr&gt;&lt;td&gt;</xsl:text><xsl:value-of select="@label"/><xsl:text>&lt;/td&gt;&lt;td&gt;</xsl:text><xsl:value-of select="@value"/><xsl:text>&lt;/td&gt;&lt;/tr&gt;</xsl:text>
        </xsl:template>
</xsl:stylesheet></pre>
<p></code><br />
And a sample xml string is as follows:<br />
<code>
<pre class="brush:xml">
<?xml version="1.0" encoding="utf-8"?>
<Order title='Body Rides'>
	<Info label='Additional answer code' value='' />
	<Info label='Additional answer date' value='' />
	<Info label='Answer code' value='' />
	<Info label='TOS' value=''/>
	<Info label='Answer date' value ='' />
	<Info label='Author' value='Richard Laymon'/>
	<Info label='Delivery to' value='Company Name, Address Line 1, AddressLine 2' />
	<Info label='Expected delivery' value='09/08/2009' />
	<Info label='Held orders' value=''/>
	<Info label='Ordered on' value='20/07/2009'/>
	<Info label='Print runs' value='' />
</Order>
</pre>
<p></code><br />
The result from the transformation is as follows:<br />
<code>
<pre class="brush:xml">
<table class="panelTable">
<tr>
<td colspan="2" class="TitlePanelHeader">Body Rides</td>
</tr>
<tr>
<td>Additional answer code</td>
<td/></tr>
<tr>
<td>Additional answer date</td>
<td/></tr>
<tr>
<td>Answer code</td>
<td/></tr>
<tr>
<td>TOS</td>
<td/></tr>
<tr>
<td>Answer date</td>
<td/></tr>
<tr>
<td>Author</td>
<td>Richard Laymon</td>
</tr>
<tr>
<td>Delivery to</td>
<td>Company Name, Address Line 1, AddressLine 2</td>
</tr>
<tr>
<td>Expected delivery</td>
<td>09/08/2009</td>
</tr>
<tr>
<td>Held orders</td>
<td/></tr>
<tr>
<td>Ordered on</td>
<td>20/07/2009</td>
</tr>
<tr>
<td>Print runs</td>
<td/></tr>
</table>
</pre>
<p></code><br />
The code to build up the xml within the object is below, note that the values are HtmlEncoded to ensure that there are no problems in the web page.<br />
<code>
<pre class="brush:c#">
public string AdditionalInformation
{
    get
    {
        StringBuilder builder = new StringBuilder();
        builder.Append(string.Format(CultureInfo.CurrentCulture,
                                        @"<Order title=""{0}"">",
                                        HttpUtility.HtmlEncode(this.Title)));
        AddLabelValue(builder, "Account number", ParentPurchaseOrder.AccountNumber);
        AddLabelValue(builder, "Additional answer code", this.AdditionalAnswerCode);
        AddLabelValue(builder, "Additional answer date",
            this.AdditionalAnswerDate.Year != 1 ? this.AdditionalAnswerDate.ToShortDateString() : "" );
        AddLabelValue(builder, "Answer code", this.AnswerCode);
        AddLabelValue(builder, "Answer date",
            this.AnswerDate.Year != 1 ? this.AnswerDate.ToShortDateString() : "");
        AddLabelValue(builder,"Author", this.Author);
        AddLabelValue(builder, "Delivery to",
            ParentPurchaseOrder.DeliveryName + ", " + ParentPurchaseOrder.Address1 + ", " +
                          ParentPurchaseOrder.Address2 + ", " +
                          ParentPurchaseOrder.Address3 + ", " +
                          ParentPurchaseOrder.Address4 + ", " +
                          ParentPurchaseOrder.Address5 + ", " +
                          ParentPurchaseOrder.Postcode);

        AddLabelValue(builder, "Expected delivery",
ParentPurchaseOrder.ExpectedDeliveryDate.ToShortDateString());
        AddLabelValue(builder, "Held orders", this.HeldOrders);
        AddLabelValue(builder, "Ordered on", ParentPurchaseOrder.OrderedOn.ToShortDateString());
        AddLabelValue(builder, "Print runs", this.PrintRuns);
                builder.Append("</Order>");

        return builder.ToString();

    }
}

private void AddLabelValue(StringBuilder builder, string label, string value)
{
      builder.Append(string.Format(CultureInfo.CurrentCulture,
                        @"<Info label=""{0}"" value=""{1}"" />",
                         label, HttpUtility.HtmlEncode(value)));
}
</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/07/xslt-transform-from-string-to-string/&title=XSL%2FT+Transform+from+String+to+String&text=The+following+example+transforms+the+supplied+xml+string%2C+using+XSL%2FT+and+outputs+to+another+string+++using+%28StringReader+rdr+%3D+new+StringReader%28selectedLine.AdditionalInformation%29%29+%7B++++...&tags=addlabelvalue+builder%2C+builder+append%2C+builder%2C+addlabelvalue%2C+parentpurchaseorder%2C+string%2C+answer" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/07/xslt-transform-from-string-to-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>?? Operator (C# Reference)</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/05/operator-c-reference/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/05/operator-c-reference/#comments</comments>
		<pubDate>Fri, 22 May 2009 10:30:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[.Net code]]></category>
		<category><![CDATA[null]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=44</guid>
		<description><![CDATA[This operator allows you to supply an alternative value if the value being supplied is null. It only works on nullable datatypes but with a bit of googling came accross this article.


public int CurrentPage
{
    get
    {
        return (int)(ViewState["_CurrentPage"] ?? 0);
   [...]]]></description>
			<content:encoded><![CDATA[<p>This operator allows you to supply an alternative value if the value being supplied is null. It only works on nullable datatypes but with a bit of googling came accross this <a href="http://haacked.com/archive/2006/08/07/TinyTrickForViewStateBackedProperties.aspx">article</a>.</p>
<p><code>
<pre class="brush:c#">
public int CurrentPage
{
    get
    {
        return (int)(ViewState["_CurrentPage"] ?? 0);
    }
    set
    {
        this.ViewState["_CurrentPage"] = value;
    }
}</pre>
<p></code></p>
<p>The offical Microsoft <a href="http://msdn.microsoft.com/en-us/library/ms173224.aspx">article</a></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/05/operator-c-reference/&title=%3F%3F+Operator+%28C%23+Reference%29&text=This+operator+allows+you+to+supply+an+alternative+value+if+the+value+being+supplied+is+null.+It+only+works+on+nullable+datatypes+but+with+a+bit+of+googling+came+accross+this+article.&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/05/operator-c-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Event Handler Signatures</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/04/creating-event-handler-signatures/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/04/creating-event-handler-signatures/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 10:43:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[useful links]]></category>
		<category><![CDATA[.Net code]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=40</guid>
		<description><![CDATA[In Visual Studio 2008 you&#8217;ve lost the abillity to click on the drop down in the code behind and see all the event signatures that are available but haven&#8217;t handled yet. To get the signature you are after without using the properites in the desinger you can type&#8230;

this.

As you hit the . all methods and [...]]]></description>
			<content:encoded><![CDATA[<p>In Visual Studio 2008 you&#8217;ve lost the abillity to click on the drop down in the code behind and see all the event signatures that are available but haven&#8217;t handled yet. To get the signature you are after without using the properites in the desinger you can type&#8230;</p>
<p><code><br />
this.<br />
</code></p>
<p>As you hit the . all methods and events should appear, pick the event you after e.g. Load</p>
<p>Then add type <code>+=</code> after the event name and press TAB TAB, the event is automatically generated. ASP.Net auto wires the events with the correct name and signature so you should be able to delete the line of code that binds the event.</p>
<p>Check out <a href="http://www.keithelder.net/blog/archive/2008/07/07/Creating-Event-Handlers-in-C-The-Definitive-Guide.aspx">this article</a> for more info.</p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/04/creating-event-handler-signatures/&title=Creating+Event+Handler+Signatures&text=In+Visual+Studio+2008+you%26%238217%3Bve+lost+the+abillity+to+click+on+the+drop+down+in+the+code+behind+and+see+all+the+event+signatures+that+are+available+but+haven%26%238217%3Bt+handled+yet.&tags=the+event%2C+event" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/04/creating-event-handler-signatures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SessionId &#8211; keeping it the same</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/02/sessionid-keeping-it-the-same/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/02/sessionid-keeping-it-the-same/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 10:31:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[.Net code]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=36</guid>
		<description><![CDATA[If you don&#8217;t populate a value in the session of a page then the session Id will reset everytime the page is loaded.


protected void Page_PreInit(object sender, EventArgs e)
{
    //Need this line otherwise it resets the Session Id everytime!
    Session["keepme"] = "True";
}


Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t populate a value in the session of a page then the session Id will reset everytime the page is loaded.<br />
<code></p>
<pre class="brush: c#">
protected void Page_PreInit(object sender, EventArgs e)
{
    //Need this line otherwise it resets the Session Id everytime!
    Session["keepme"] = "True";
}
</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/02/sessionid-keeping-it-the-same/&title=SessionId+%26%238211%3B+keeping+it+the+same&text=If+you+don%26%238217%3Bt+populate+a+value+in+the+session+of+a+page+then+the+session+Id+will+reset+everytime+the+page+is+loaded.&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/02/sessionid-keeping-it-the-same/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sort Collection</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/02/sort-collectiont/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/02/sort-collectiont/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 14:16:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[.Net code]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=34</guid>
		<description><![CDATA[Here is a simple solution based on this article to implement a sort of a generic collection.


public ContentCollection Sort()
{
    List items = (List)Items;
    items.Sort();
    return this;
}

The Content class needs to implement IComparable
Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p>Here is a simple solution based on this <a href="http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/977ac532-afc9-46b7-bd73-a5cc41086b9c/">article</a> to implement a sort of a generic collection.</p>
<p><code></p>
<pre class="brush: c#">
public ContentCollection Sort()
{
    List<content> items = (List<content>)Items;
    items.Sort();
    return this;
}</pre>
<p></code></p>
<p>The Content class needs to implement IComparable</p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/02/sort-collectiont/&title=Sort+Collection%3CT%3E&text=Here+is+a+simple+solution+based+on+this+article+to+implement+a+sort+of+a+generic+collection.+++public+ContentCollection+Sort%28%29+%7B+++++List+items+%3D+%28List%29Items%3B+++++items.Sort%28%29%3B+++++return+this%3B+%7D+...&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/02/sort-collectiont/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# &#8211; IsNumeric</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/01/c-isnumeric/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/01/c-isnumeric/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 09:35:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[.Net code]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=30</guid>
		<description><![CDATA[Use the TryParse method to determine if a value is numeric


int retNum;
if (Int32.TryParse(BookId, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out retNum))
{
    //Is numeric
}

Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p>Use the TryParse method to determine if a value is numeric</p>
<p><code>
<pre class="brush: c#">
int retNum;
if (Int32.TryParse(BookId, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out retNum))
{
    //Is numeric
}</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/01/c-isnumeric/&title=C%23+%26%238211%3B+IsNumeric&text=Use+the+TryParse+method+to+determine+if+a+value+is+numeric+++int+retNum%3B+if+%28Int32.TryParse%28BookId%2C+System.Globalization.NumberStyles.Any%2C+System.Globalization.NumberFormatInfo.InvariantInfo%2C+out...&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/01/c-isnumeric/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Singleton Class &#8211; Basic Example</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/01/singleton-class/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/01/singleton-class/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 16:14:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[.Net code]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=27</guid>
		<description><![CDATA[Below is an example of a Singleton implementation C# class.


public sealed class StaticData
{
    private  StaticData() {}
    public static readonly StaticData Instance = new StaticData();
    string connectionString = "";
    public string ConnectionToUse
    {
        [...]]]></description>
			<content:encoded><![CDATA[<p>Below is an example of a Singleton implementation C# class.<br />
<code>
<pre class="brush: c#">
public sealed class StaticData
{
    private  StaticData() {}
    public static readonly StaticData Instance = new StaticData();
    string connectionString = "";
    public string ConnectionToUse
    {
        get
        {
            if (connectionString.Length == 0)
            {
                connectionString = System.Configuration.ConfigurationManager.AppSettings.Get("DBConnection").ToString();
            }
            return connectionString;
        }
    }
}</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/01/singleton-class/&title=Singleton+Class+%26%238211%3B+Basic+Example&text=Below+is+an+example+of+a+Singleton+implementation+C%23+class.+++public+sealed+class+StaticData+%7B+++++private++StaticData%28%29+%7B%7D+++++public+static+readonly+StaticData+Instance+%3D+new+StaticData%28%29%3B++++...&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/01/singleton-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Output Parameters with returned value</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/01/output-parameters-with-returned-value/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/01/output-parameters-with-returned-value/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 10:06:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[.Net code]]></category>
		<category><![CDATA[null]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=26</guid>
		<description><![CDATA[When using output parameter values you need to check that the value is not DBNull before using it&#8230;


using (SqlConnection conn = new SqlConnection())
{
    conn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings.Get("DBConnection").ToString();
    conn.Open();
    using (SqlCommand cmd = new SqlCommand())
    {
        cmd.Connection = [...]]]></description>
			<content:encoded><![CDATA[<p>When using output parameter values you need to check that the value is not DBNull before using it&#8230;</p>
<p><code>
<pre class="brush: c#">
using (SqlConnection conn = new SqlConnection())
{
    conn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings.Get("DBConnection").ToString();
    conn.Open();
    using (SqlCommand cmd = new SqlCommand())
    {
        cmd.Connection = conn;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add(new SqlParameter("@ChapterId", _ChapterId));
        cmd.Parameters.Add(new SqlParameter("@Sequence", _Sequence));
        cmd.CommandText = "Get_ContentPrevNext";
        SqlParameter parameterPreviousId = new SqlParameter("@PreviousId", System.Data.SqlDbType.Int)
        {
            Direction = System.Data.ParameterDirection.Output
        };
        cmd.Parameters.Add(parameterPreviousId);
        SqlParameter parameterNextId = new SqlParameter("@NextId", System.Data.SqlDbType.Int)
        {
            Direction = System.Data.ParameterDirection.Output
        };
        cmd.Parameters.Add(parameterNextId);
        cmd.ExecuteNonQuery();
        if (parameterPreviousId.Value != DBNull.Value)
        {
            _PreviousId = Convert.ToInt32(parameterPreviousId.Value);
        }
        if (parameterNextId.Value != DBNull.Value)
        {
            _NextId = Convert.ToInt32(parameterNextId.Value);
        }
    }
}</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/01/output-parameters-with-returned-value/&title=Output+Parameters+with+returned+value&text=When+using+output+parameter+values+you+need+to+check+that+the+value+is+not+DBNull+before+using+it%26%238230%3B+++using+%28SqlConnection+conn+%3D+new+SqlConnection%28%29%29+%7B+++++conn.ConnectionString+%3D...&tags=cmd+parameters%2C+new+sqlparameter%2C+value%2C+sqlparameter%2C+system" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/01/output-parameters-with-returned-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image from Byte Array</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/01/image-from-byte-array/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/01/image-from-byte-array/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 16:17:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[.Net code]]></category>
		<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=25</guid>
		<description><![CDATA[To render an image to a picturebox using the data stored in a byte array use the following code


using (MemoryStream ms = new MemoryStream(ImageDetails.ThumbnailImage))
{
    ThumbnailImage.Image = Image.FromStream(ms);
}

Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p>To render an image to a picturebox using the data stored in a byte array use the following code<br />
<code></p>
<pre class="brush: c#">
using (MemoryStream ms = new MemoryStream(ImageDetails.ThumbnailImage))
{
    ThumbnailImage.Image = Image.FromStream(ms);
}</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/01/image-from-byte-array/&title=Image+from+Byte+Array&text=To+render+an+image+to+a+picturebox+using+the+data+stored+in+a+byte+array+use+the+following+code+++using+%28MemoryStream+ms+%3D+new+MemoryStream%28ImageDetails.ThumbnailImage%29%29+%7B+++++ThumbnailImage.Image+%3D...&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/01/image-from-byte-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Render Image using Generic Handler ASP.Net</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/01/render-image-using-generic-handler-aspnet/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/01/render-image-using-generic-handler-aspnet/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 11:27:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[ashx]]></category>
		<category><![CDATA[.Net code]]></category>
		<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=24</guid>
		<description><![CDATA[The following code uses a property from an object that returns a byte array that contains an image.


public void ProcessRequest(HttpContext context)
{
    context.Response.ContentType = "image/jpg";
    if (context.Request.Params["Id"] != null)
    {
        Content selectedImage = new Content(Convert.ToInt32(context.Request.Params["Id"].ToString()));
      [...]]]></description>
			<content:encoded><![CDATA[<p>The following code uses a property from an object that returns a byte array that contains an image.</p>
<p><code>
<pre class="brush:c#">
public void ProcessRequest(HttpContext context)
{
    context.Response.ContentType = "image/jpg";
    if (context.Request.Params["Id"] != null)
    {
        Content selectedImage = new Content(Convert.ToInt32(context.Request.Params["Id"].ToString()));
        if (context.Request.Params["t"] == "D")
        {
            context.Response.OutputStream.Write(selectedImage.ImageDetails.FullImage, 0, selectedImage.ImageDetails.FullImage.Length);
        }
        else
        {
            context.Response.OutputStream.Write(selectedImage.ImageDetails.ThumbnailImage, 0, selectedImage.ImageDetails.ThumbnailImage.Length);
        }
    }
}</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/01/render-image-using-generic-handler-aspnet/&title=Render+Image+using+Generic+Handler+ASP.Net&text=The+following+code+uses+a+property+from+an+object+that+returns+a+byte+array+that+contains+an+image.+++public+void+ProcessRequest%28HttpContext+context%29+%7B+++++context.Response.ContentType+%3D+%22image%2Fjpg%22%3B...&tags=selectedimage+imagedetails%2C+context+request%2C+context%2C+selectedimage" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/01/render-image-using-generic-handler-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
