<?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>Quickduck &#187; Daily Question</title>
	<atom:link href="http://quickduck.com/blog/category/development/net/daily-question/feed/" rel="self" type="application/rss+xml" />
	<link>http://quickduck.com/blog</link>
	<description>Straight from the mind of geniuseseses....</description>
	<lastBuildDate>Wed, 30 Jun 2010 10:52:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Question of the day: Threading</title>
		<link>http://quickduck.com/blog/2010/06/30/question-of-the-day-threading/</link>
		<comments>http://quickduck.com/blog/2010/06/30/question-of-the-day-threading/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 10:52:18 +0000</pubDate>
		<dc:creator>Gerrod</dc:creator>
				<category><![CDATA[Daily Question]]></category>
		<category><![CDATA[Threading]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/?p=313</guid>
		<description><![CDATA[Here&#8217;s a little question about Threading &#8211; this would be a great interview question, in my opinion! Given the code below: public class Producer { [ThreadStatic] readonly static private Producer _instance = new Producer(); static private int _instanceCount; readonly private int _instanceId; private Producer() { _instanceId = ++_instanceCount; } static public Producer Instance { get [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little question about Threading &#8211; this would be a great interview question, in my opinion!</p>
<p>Given the code below:</p>
<pre class="brush: csharp;">
public class Producer
{
    [ThreadStatic]
    readonly static private Producer _instance = new Producer();

    static private int _instanceCount;
    readonly private int _instanceId;

    private Producer()
    {
        _instanceId = ++_instanceCount;
    }

    static public Producer Instance
    {
        get { return _instance; }
    }

    public string Name
    {
        get
        {
            return String.Format(&quot;Instance {0} of {1}&quot;,
                _instanceId, _instanceCount);
        }
    }
}

public class Consumer
{
    public Consumer()
    {
        Thread t1 = new Thread(IdentifyProducer);
        t1.Start();

        Thread t2 = new Thread(IdentifyProducer);
        t2.Start();

        t1.Join();
        t2.Join();
    }

    public void IdentifyProducer()
    {
        Console.WriteLine(Producer.Instance.Name);
    }
}
</pre>
<p>What will happen when you create a new instance of the Consumer class?</p>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2010/06/30/question-of-the-day-threading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Question of the day: Enums</title>
		<link>http://quickduck.com/blog/2009/10/07/question-of-the-day-enums/</link>
		<comments>http://quickduck.com/blog/2009/10/07/question-of-the-day-enums/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 10:20:41 +0000</pubDate>
		<dc:creator>Gerrod</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Daily Question]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/?p=198</guid>
		<description><![CDATA[Some fun with enums! Assume you have an enum defined as follows: enum Frequency { None = 0, Annual = 1, SemiAnnual = 2, Quarterly = 4, Monthly = 12, Weekly = 52 } Now, given the following block of code: Frequency myFrequency = (Frequency) 104; System.Console.WriteLine(&#34;My frequency is: {0}&#34;, myFrequency.ToString()); bool is100Defined = Enum.IsDefined(typeof(Frequency), [...]]]></description>
			<content:encoded><![CDATA[<p>Some fun with enums! Assume you have an enum defined as follows:</p>
<pre class="brush: csharp;">
enum Frequency {
    None = 0,
    Annual = 1,
    SemiAnnual = 2,
    Quarterly = 4,
    Monthly = 12,
    Weekly = 52
}
</pre>
<p>Now, given the following block of code:</p>
<pre class="brush: csharp;">
Frequency myFrequency = (Frequency) 104;
System.Console.WriteLine(&quot;My frequency is: {0}&quot;, myFrequency.ToString());
bool is100Defined = Enum.IsDefined(typeof(Frequency), 100);
bool is52Defined  = Enum.IsDefined(typeof(Frequency), 52);
</pre>
<ol>
<li>What is written to the console?</li>
<li>What is the value of is100Defined?</li>
<li>What is the value of is52Defined?</li>
</ol>
<p>First correct answer gets absolutely nothing (but think how great you&#8217;ll feel!)</p>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2009/10/07/question-of-the-day-enums/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Reader challenge!</title>
		<link>http://quickduck.com/blog/2008/11/03/reader-challenge/</link>
		<comments>http://quickduck.com/blog/2008/11/03/reader-challenge/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 17:09:02 +0000</pubDate>
		<dc:creator>Gerrod</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Daily Question]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/2008/11/03/reader-challenge/</guid>
		<description><![CDATA[It&#8217;s been a while since we&#8217;ve had a reader question, so here&#8217;s one for you all. It&#8217;s not that I can&#8217;t solve this problem; it&#8217;s more that I&#8217;m wondering if there&#8217;s a more elegant solution. The Problem: Given two dates, what&#8217;s the easiest way of determining if they fall in the same week? Please submit [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since we&#8217;ve had a reader question, so here&#8217;s one for you all. It&#8217;s not that I <i>can&#8217;t</i> solve this problem; it&#8217;s more that I&#8217;m wondering if there&#8217;s a more elegant solution.</p>
<p><b>The Problem:</b> Given two dates, what&#8217;s the easiest way of determining if they fall in the same week?</p>
<p>Please submit your answers as a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2008/11/03/reader-challenge/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Daily question: Fun with constructors</title>
		<link>http://quickduck.com/blog/2008/07/10/daily-question-fun-with-constructors/</link>
		<comments>http://quickduck.com/blog/2008/07/10/daily-question-fun-with-constructors/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 16:10:17 +0000</pubDate>
		<dc:creator>Gerrod</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Daily Question]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/2008/07/10/daily-question-fun-with-constructors/</guid>
		<description><![CDATA[It&#8217;s been a while since anyone has posted a daily question, but here&#8217;s one to get y&#8217;all in the mood&#8230; Given the following code: public class BaseClass { public BaseClass() : this("Base value") { Console.WriteLine("Base: Empty"); } public BaseClass(object value) { Console.WriteLine("Base with value: {0}", value); } } public class DerivedClass : BaseClass { public [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since anyone has posted a daily question, but here&#8217;s one to get y&#8217;all in the mood&#8230; </p>
<p>Given the following code:</p>
<pre><code>
public class BaseClass {
    public BaseClass() : this("Base value") {
        Console.WriteLine("Base: Empty");
    }

    public BaseClass(object value) {
        Console.WriteLine("Base with value: {0}", value);
    }
}

public class DerivedClass : BaseClass {
    public DerivedClass() : this("Derived value") {
        Console.WriteLine("Derived: Empty");
    }

    public DerivedClass(object value) : base(value) {
        Console.WriteLine("Derived with value: {0}", value);
    }
}
</code></pre>
<p>What will be printed to the console when a new DerivedClass object is created using the default DerivedClass constructor:</p>
<pre><code>
    new DerivedClass();
</code></pre>
<p>First person to post the correct answer wins a prize consiting solely of that warm fuzzy feeling you get by being the first person to answer a question correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2008/07/10/daily-question-fun-with-constructors/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Best Visual Studio Shortcut</title>
		<link>http://quickduck.com/blog/2006/12/22/best-visual-studio-shortcut/</link>
		<comments>http://quickduck.com/blog/2006/12/22/best-visual-studio-shortcut/#comments</comments>
		<pubDate>Fri, 22 Dec 2006 14:58:15 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Daily Question]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/?p=16</guid>
		<description><![CDATA[A work colleague and I were discussing what we thought the best Visual Studio keyboard shortcut was. The shortcut had to be a VS one and not that of a third party (eg. Resharper). We came to the conclusion that Alt-Shift-Enter to enter into and out of Full Screen mode took 1st prize. The shortcut [...]]]></description>
			<content:encoded><![CDATA[<p>A work colleague and I were discussing what we thought the best Visual Studio keyboard shortcut was.<br />
The shortcut had to be a VS one and not that of a third party (eg. Resharper).</p>
<p>We came to the conclusion that Alt-Shift-Enter to enter into and out of Full Screen mode took 1st prize.</p>
<p>The shortcut to save &#8211; ctrl-s &#8211; is pretty handy too, but we decided this was not unique to VS and was more of a windows common-look-and-feel item.</p>
<p>What&#8217;s your favourite VS keyboard shortcut?</p>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2006/12/22/best-visual-studio-shortcut/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>What&#8217;s the difference between &lt;%= %&gt; and &lt;%# %&gt;</title>
		<link>http://quickduck.com/blog/2006/11/20/whats-the-difference-between-and/</link>
		<comments>http://quickduck.com/blog/2006/11/20/whats-the-difference-between-and/#comments</comments>
		<pubDate>Tue, 21 Nov 2006 06:26:50 +0000</pubDate>
		<dc:creator>Gerrod</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Daily Question]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/?p=6</guid>
		<description><![CDATA[A daily question from a while back that had perplexed me for ages: Q: In a DataBound control, what&#8217;s the difference between using a &#60;%= %&#62; block, and a &#60;%# %&#62; block? Of course I actually did know the difference, and when I should use each one, but Bender summed up the correct answer the [...]]]></description>
			<content:encoded><![CDATA[<p>A daily question from a while back that had perplexed me for ages:</p>
<blockquote><p>Q: In a DataBound control, what&#8217;s the difference between using a &lt;%= %&gt; block, and a &lt;%# %&gt; block?</i></p></blockquote>
<p>Of course I actually <i>did</i> know the difference, and when I should use each one, but Bender summed up the correct answer the best:</p>
<blockquote><p>A: You use a &lt;%# %&gt; block if you need access to the underlying DataSource of the repeating control (e.g. you need to access the DataItem with an Eval statement, or you need access to the Container element).</p>
<p>When you do <i>not</i> need to access the underlying DataSource, use a &lt;%= %&gt; block instead.</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2006/11/20/whats-the-difference-between-and/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
