<?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>Interview</title>
	<atom:link href="http://interview.msdotnetheaven.com/feed" rel="self" type="application/rss+xml" />
	<link>http://interview.msdotnetheaven.com</link>
	<description>Best place for interview preparation</description>
	<lastBuildDate>Sat, 21 May 2011 21:43:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Define interface in own words.</title>
		<link>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/define-interface-in-own-words.html</link>
		<comments>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/define-interface-in-own-words.html#comments</comments>
		<pubDate>Sat, 21 May 2011 21:43:04 +0000</pubDate>
		<dc:creator>meghna</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Microsoft .Net]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=674</guid>
		<description><![CDATA[We have many books around, anyone can get a definition of interface which is nothing but bookish. In these days we are more interested to know what you know about interfaces rather than what you read for interfaces?
Here, I tried to cover interfaces in my own words:
Interface
An interface is simply a collection of function prototypes. An Interface is a reference type like a class, but interface can contain only abstract members. In other words, Interface is a contract that defines the signature of the functionality.
An interface looks like a class ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html' rel='bookmark' title='Permanent Link: What are Classes and structures'>What are Classes and structures</a></li>
<li><a href='http://interview.msdotnetheaven.com/oops-questions-and-answers/what-is-differance-between-abstract-and-interface.html' rel='bookmark' title='Permanent Link: What is differance between Abstract and Interface'>What is differance between Abstract and Interface</a></li>
<li><a href='http://interview.msdotnetheaven.com/uml-interview-questions-and-answers/what-are-the-good-practices-to-use-while-designing-for-reuse.html' rel='bookmark' title='Permanent Link: What are the good practices to use while designing for reuse'>What are the good practices to use while designing for reuse</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>We have many books around, anyone can get a definition of interface which is nothing but bookish. In these days we are more interested to know what you know about interfaces rather than what you read for interfaces?</p>
<p>Here, I tried to cover interfaces in my own words:</p>
<h3>Interface</h3>
<p>An interface is simply a collection of function prototypes. An Interface is a reference type like a class, but interface can contain only abstract members. In other words, Interface is a contract that defines the signature of the functionality.</p>
<p>An interface looks like a class definitions, but its only purpose is to define a set of methods and not to implement them. For this reason the interface definition includes only the definition of methods [in other words the abstract methods]. Interface contains only methods, properties and delegates but can not contain fields, constructors, destructor and any type of static members.</p>
<p>For more details and example refer to : <a href="http://gauravarora.indiamentor.com/Chapters/csharplanguageii.htm">http://gauravarora.indiamentor.com/Chapters/csharplanguageii.htm</a></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Define+interface+in+own+words.+http%3A%2F%2Ftinyurl.com%2F3kmbfgv" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Define+interface+in+own+words.+http%3A%2F%2Ftinyurl.com%2F3kmbfgv" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=674&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html' rel='bookmark' title='Permanent Link: What are Classes and structures'>What are Classes and structures</a></li>
<li><a href='http://interview.msdotnetheaven.com/oops-questions-and-answers/what-is-differance-between-abstract-and-interface.html' rel='bookmark' title='Permanent Link: What is differance between Abstract and Interface'>What is differance between Abstract and Interface</a></li>
<li><a href='http://interview.msdotnetheaven.com/uml-interview-questions-and-answers/what-are-the-good-practices-to-use-while-designing-for-reuse.html' rel='bookmark' title='Permanent Link: What are the good practices to use while designing for reuse'>What are the good practices to use while designing for reuse</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/define-interface-in-own-words.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are Classes and structures</title>
		<link>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html</link>
		<comments>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html#comments</comments>
		<pubDate>Wed, 18 May 2011 05:49:57 +0000</pubDate>
		<dc:creator>gaurav.arora</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Microsoft .Net]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=671</guid>
		<description><![CDATA[A very basic and common questions asked many time to freshers, novoice or intermediate level interviews. I got many emails for the same questions, hereunder I try to answer in a simpler way.
Structures
A structure in C# is simply a composite data type [you are well aware from composite data type, refer to data types for more details], which consists number of members of other types. The structure define simply by using the struct keyword.
eg. struct enroll
{
   public string name, fname, mname;
   public string char sex;
   Public int age;
   public string address;
}
Classes
It is cleared from ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/asp-net-interview-questions/can-i-inherit-two-difference-classes-to-partial-classes.html' rel='bookmark' title='Permanent Link: Can I inherit two difference classes to partial classes?'>Can I inherit two difference classes to partial classes?</a></li>
<li><a href='http://interview.msdotnetheaven.com/general-interview-stuffs/is-it-possible-to-create-constructor-for-an-abstract-class.html' rel='bookmark' title='Permanent Link: Is it possible to create constructor for an Abstract class?'>Is it possible to create constructor for an Abstract class?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html' rel='bookmark' title='Permanent Link: How can I create a Singleton class by using public constructor?'>How can I create a Singleton class by using public constructor?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A very basic and common questions asked many time to freshers, novoice or intermediate level interviews. I got many emails for the same questions, hereunder I try to answer in a simpler way.</p>
<h3>Structures</h3>
<p>A structure in C# is simply a composite data type [you are well aware from composite data type, refer to data types for more details], which consists number of members of other types. The structure define simply by using the struct keyword.</p>
<p>eg. struct enroll<br />
{<br />
   public string name, fname, mname;<br />
   public string char sex;<br />
   Public int age;<br />
   public string address;<br />
}</p>
<h3>Classes</h3>
<p>It is cleared from above study that Classes are reference type. A class is a collection of its data members. Data members are those members of class which contains the data of class like fields, constants and events etc. Class is declared simply just followed by class keyword with optional modifiers; by default C# classes are public.</p>
<p>eg. class myClass<br />
{<br />
   public int xyz;<br />
   public string name;<br />
   public const int y=22;<br />
}</p>
<p>Look into more details at : <a href="http://gauravarora.indiamentor.com/Chapters/csharplanguageii.htm">http://gauravarora.indiamentor.com/Chapters/csharplanguageii.htm</a></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=What+are+Classes+and+structures+http%3A%2F%2Ftinyurl.com%2F6xzk9sl" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=What+are+Classes+and+structures+http%3A%2F%2Ftinyurl.com%2F6xzk9sl" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=671&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/asp-net-interview-questions/can-i-inherit-two-difference-classes-to-partial-classes.html' rel='bookmark' title='Permanent Link: Can I inherit two difference classes to partial classes?'>Can I inherit two difference classes to partial classes?</a></li>
<li><a href='http://interview.msdotnetheaven.com/general-interview-stuffs/is-it-possible-to-create-constructor-for-an-abstract-class.html' rel='bookmark' title='Permanent Link: Is it possible to create constructor for an Abstract class?'>Is it possible to create constructor for an Abstract class?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html' rel='bookmark' title='Permanent Link: How can I create a Singleton class by using public constructor?'>How can I create a Singleton class by using public constructor?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is it possible to create constructor for an Abstract class?</title>
		<link>http://interview.msdotnetheaven.com/general-interview-stuffs/is-it-possible-to-create-constructor-for-an-abstract-class.html</link>
		<comments>http://interview.msdotnetheaven.com/general-interview-stuffs/is-it-possible-to-create-constructor-for-an-abstract-class.html#comments</comments>
		<pubDate>Thu, 29 Apr 2010 15:07:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[c# interview question]]></category>

		<guid isPermaLink="false">http://www.interview.msdotnetheaven.com/?p=665</guid>
		<description><![CDATA[Yes, its possible to create constructors for Abstract classes.  We can create Private, Public and Protected constructors for Abstract classes
Example:
Abstract class  myAbstClass
{
public  myAbstClass()
{          }
private myAbstClass(int x)
{       //some implementation      }
protected myAbstClass(string strX, string strY, int x)
{    //some implementation }
}
  Tweet This Post

Related posts:How can I create a Singleton class by using public constructor?
What is differance between Abstract and Interface
What are Classes and structures



Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html' rel='bookmark' title='Permanent Link: How can I create a Singleton class by using public constructor?'>How can I create a Singleton class by using public constructor?</a></li>
<li><a href='http://interview.msdotnetheaven.com/oops-questions-and-answers/what-is-differance-between-abstract-and-interface.html' rel='bookmark' title='Permanent Link: What is differance between Abstract and Interface'>What is differance between Abstract and Interface</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html' rel='bookmark' title='Permanent Link: What are Classes and structures'>What are Classes and structures</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Yes, its possible to create constructors for Abstract classes.  We can create Private, Public and Protected constructors for Abstract classes</p>
<blockquote><p>Example:</p>
<p>Abstract class  myAbstClass</p>
<p>{</p>
<p>public  myAbstClass()</p>
<p>{          }</p>
<p>private myAbstClass(int x)</p>
<p>{       //some implementation      }</p>
<p>protected myAbstClass(string strX, string strY, int x)</p>
<p>{    //some implementation }</p>
<p>}</p></blockquote>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Is+it+possible+to+create+constructor+for+an+Abstract+class%3F+http%3A%2F%2Ftinyurl.com%2F5vff3qt" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Is+it+possible+to+create+constructor+for+an+Abstract+class%3F+http%3A%2F%2Ftinyurl.com%2F5vff3qt" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=665&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html' rel='bookmark' title='Permanent Link: How can I create a Singleton class by using public constructor?'>How can I create a Singleton class by using public constructor?</a></li>
<li><a href='http://interview.msdotnetheaven.com/oops-questions-and-answers/what-is-differance-between-abstract-and-interface.html' rel='bookmark' title='Permanent Link: What is differance between Abstract and Interface'>What is differance between Abstract and Interface</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html' rel='bookmark' title='Permanent Link: What are Classes and structures'>What are Classes and structures</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/general-interview-stuffs/is-it-possible-to-create-constructor-for-an-abstract-class.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write query to get custom results</title>
		<link>http://interview.msdotnetheaven.com/database-question-answer/write-query-to-get-custom-results.html</link>
		<comments>http://interview.msdotnetheaven.com/database-question-answer/write-query-to-get-custom-results.html#comments</comments>
		<pubDate>Mon, 08 Feb 2010 10:30:01 +0000</pubDate>
		<dc:creator>smartbrain</dc:creator>
				<category><![CDATA[Database Questions]]></category>
		<category><![CDATA[MsSql Server]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[select]]></category>
		<category><![CDATA[Sql Server 2005]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=659</guid>
		<description><![CDATA[This question is asked in recent interview, following is the scenario:
Q. I have a following table :



University
UtoTal
Status
StatusCnt


U1
100
Pending
20


U1
100
Active
20


U1
100
Deferred
60


U2
60
Pending
20


U2
60
Active
20


U2
60
Deferred
20



I want results as :



University
UtoTal
Status
StatusCnt


U1
100
Pending
20




Active
20




Deferred
60


U2
60
Pending
20




Active
20




Deferred
20



Ans: At the time of interview I wasn&#8217;t easy with the answer but I wrote a query, but interviewer not satisfied.
I got the following proper query/solution from one of my colleagues Mr. sandeep Walia:
declare @tbl table(university varchar(100),Utotals int, status varchar(100),statuscnt int)
insert into @tbl(university,Utotals,status,statuscnt)
select &#8216;u1&#8242;,100,&#8217;pending&#8217;,20
union all
select &#8216;u1&#8242;,100,&#8217;Active&#8217;,20
union all
select &#8216;u1&#8242;,100,&#8217;Deferred&#8217;,60
union all
select &#8216;u2&#8242;,60,&#8217;pending&#8217;,20
union all
select &#8216;u2&#8242;,60,&#8217;Active&#8217;,20
union all
select &#8216;u2&#8242;,60,&#8217;Deferred&#8217;,20
select * from @tbl;
with cte as (
SELECT ROW_NUMBER() OVER(PARTITION BY university ORDER BY university DESC) AS RowID,
*
FROM ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/database-question-answer/create-dynamic-query-with-dynamic-joins.html' rel='bookmark' title='Permanent Link: Create dynamic query with dynamic joins'>Create dynamic query with dynamic joins</a></li>
<li><a href='http://interview.msdotnetheaven.com/database-question-answer/mssql-question-answer/change-date-format-mmddyy-to-ddmmyy-using-query.html' rel='bookmark' title='Permanent Link: Change date format mm/dd/yy to dd/mm/yy using query?'>Change date format mm/dd/yy to dd/mm/yy using query?</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-vsam-question-answer/what-is-file-status-in-vsam.html' rel='bookmark' title='Permanent Link: What is File Status in VSAM?'>What is File Status in VSAM?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This question is asked in recent interview, following is the scenario:</p>
<p>Q. I have a following table :</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="128" valign="top"><strong>University</strong></td>
<td width="128" valign="top"><strong>UtoTal</strong></td>
<td width="128" valign="top"><strong>Status</strong></td>
<td width="128" valign="top"><strong>StatusCnt</strong></td>
</tr>
<tr>
<td width="128" valign="top">U1</td>
<td width="128" valign="top">100</td>
<td width="128" valign="top">Pending</td>
<td width="128" valign="top">20</td>
</tr>
<tr>
<td width="128" valign="top">U1</td>
<td width="128" valign="top">100</td>
<td width="128" valign="top">Active</td>
<td width="128" valign="top">20</td>
</tr>
<tr>
<td width="128" valign="top">U1</td>
<td width="128" valign="top">100</td>
<td width="128" valign="top">Deferred</td>
<td width="128" valign="top">60</td>
</tr>
<tr>
<td width="128" valign="top">U2</td>
<td width="128" valign="top">60</td>
<td width="128" valign="top">Pending</td>
<td width="128" valign="top">20</td>
</tr>
<tr>
<td width="128" valign="top">U2</td>
<td width="128" valign="top">60</td>
<td width="128" valign="top">Active</td>
<td width="128" valign="top">20</td>
</tr>
<tr>
<td width="128" valign="top">U2</td>
<td width="128" valign="top">60</td>
<td width="128" valign="top">Deferred</td>
<td width="128" valign="top">20</td>
</tr>
</tbody>
</table>
<p>I want results as :</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="128" valign="top"><strong>University</strong></td>
<td width="128" valign="top"><strong>UtoTal</strong></td>
<td width="128" valign="top"><strong>Status</strong></td>
<td width="128" valign="top"><strong>StatusCnt</strong></td>
</tr>
<tr>
<td width="128" valign="top">U1</td>
<td width="128" valign="top">100</td>
<td width="128" valign="top">Pending</td>
<td width="128" valign="top">20</td>
</tr>
<tr>
<td width="128" valign="top"></td>
<td width="128" valign="top"></td>
<td width="128" valign="top">Active</td>
<td width="128" valign="top">20</td>
</tr>
<tr>
<td width="128" valign="top"></td>
<td width="128" valign="top"></td>
<td width="128" valign="top">Deferred</td>
<td width="128" valign="top">60</td>
</tr>
<tr>
<td width="128" valign="top">U2</td>
<td width="128" valign="top">60</td>
<td width="128" valign="top">Pending</td>
<td width="128" valign="top">20</td>
</tr>
<tr>
<td width="128" valign="top"></td>
<td width="128" valign="top"></td>
<td width="128" valign="top">Active</td>
<td width="128" valign="top">20</td>
</tr>
<tr>
<td width="128" valign="top"></td>
<td width="128" valign="top"></td>
<td width="128" valign="top">Deferred</td>
<td width="128" valign="top">20</td>
</tr>
</tbody>
</table>
<p><strong>Ans:</strong> At the time of interview I wasn&#8217;t easy with the answer but I wrote a query, but interviewer not satisfied.</p>
<p>I got the following proper query/solution from one of my colleagues <strong>Mr. sandeep Walia:</strong></p>
<blockquote><p>declare @tbl table(university varchar(100),Utotals int, status varchar(100),statuscnt int)</p>
<p>insert into @tbl(university,Utotals,status,statuscnt)</p>
<p>select &#8216;u1&#8242;,100,&#8217;pending&#8217;,20</p>
<p>union all</p>
<p>select &#8216;u1&#8242;,100,&#8217;Active&#8217;,20</p>
<p>union all</p>
<p>select &#8216;u1&#8242;,100,&#8217;Deferred&#8217;,60</p>
<p>union all</p>
<p>select &#8216;u2&#8242;,60,&#8217;pending&#8217;,20</p>
<p>union all</p>
<p>select &#8216;u2&#8242;,60,&#8217;Active&#8217;,20</p>
<p>union all</p>
<p>select &#8216;u2&#8242;,60,&#8217;Deferred&#8217;,20</p>
<p>select * from @tbl;</p>
<p>with cte as (</p>
<p>SELECT ROW_NUMBER() OVER(PARTITION BY university ORDER BY university DESC) AS RowID,</p>
<p>*</p>
<p>FROM @tbl</p>
<p>)</p>
<p>SELECT case when rowid=1 then university else null end university,case when rowid=1 then Utotals else null end Utotals,status,statuscnt</p>
<p>FROM cte</p></blockquote>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Write+query+to+get+custom+results+http%3A%2F%2Ftinyurl.com%2F5szoj2s" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Write+query+to+get+custom+results+http%3A%2F%2Ftinyurl.com%2F5szoj2s" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=659&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/database-question-answer/create-dynamic-query-with-dynamic-joins.html' rel='bookmark' title='Permanent Link: Create dynamic query with dynamic joins'>Create dynamic query with dynamic joins</a></li>
<li><a href='http://interview.msdotnetheaven.com/database-question-answer/mssql-question-answer/change-date-format-mmddyy-to-ddmmyy-using-query.html' rel='bookmark' title='Permanent Link: Change date format mm/dd/yy to dd/mm/yy using query?'>Change date format mm/dd/yy to dd/mm/yy using query?</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-vsam-question-answer/what-is-file-status-in-vsam.html' rel='bookmark' title='Permanent Link: What is File Status in VSAM?'>What is File Status in VSAM?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/database-question-answer/write-query-to-get-custom-results.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create dynamic query with dynamic joins</title>
		<link>http://interview.msdotnetheaven.com/database-question-answer/create-dynamic-query-with-dynamic-joins.html</link>
		<comments>http://interview.msdotnetheaven.com/database-question-answer/create-dynamic-query-with-dynamic-joins.html#comments</comments>
		<pubDate>Thu, 04 Feb 2010 15:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database Questions]]></category>
		<category><![CDATA[MsSql Server]]></category>
		<category><![CDATA[dynamic joins]]></category>
		<category><![CDATA[dynamic query]]></category>
		<category><![CDATA[joins]]></category>
		<category><![CDATA[Sql2005]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=656</guid>
		<description><![CDATA[Q. Here is the scenario:

declare @tt table(col1 varchar(10), joinexp varchar(100))
insert into @tt
select &#8216;c1&#8242;,&#8217;join table2 on table1.id = table1.id&#8217;
union all
select &#8216;c2&#8242;,&#8217;join table3 on table2.id = table1.id&#8217;
union all
select &#8216;c3&#8242;,&#8217;join table4 on table3.id = table1.id&#8217;
union all
select &#8216;c4&#8242;,&#8217;join table5 on table5.id = table1.id&#8217;
union all
select &#8216;c5&#8242;,NULL
union all
select &#8216;c6&#8242;,NULL
declare @str varchar(1000)
set @str = &#8216;Select c1,c4,c5,c8,c9 from table1&#8242;
declare @tt table(col1 varchar(10), joinexp varchar(100))insert into @ttselect &#8216;c1&#8242;,&#8217;join table2 on table1.id = table1.id&#8217;union allselect &#8216;c2&#8242;,&#8217;join table3 on table2.id = table1.id&#8217;union allselect &#8216;c3&#8242;,&#8217;join table4 on table3.id = table1.id&#8217;union allselect &#8216;c4&#8242;,&#8217;join table5 on table5.id = table1.id&#8217;union allselect &#8216;c5&#8242;,NULLunion allselect &#8216;c6&#8242;,NULL
declare @str ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/database-question-answer/write-query-to-get-custom-results.html' rel='bookmark' title='Permanent Link: Write query to get custom results'>Write query to get custom results</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-db2-question-answer/what-is-the-syntax-required-for-the-creation-of-a-cursor.html' rel='bookmark' title='Permanent Link: What is the syntax required for the creation of a cursor?'>What is the syntax required for the creation of a cursor?</a></li>
<li><a href='http://interview.msdotnetheaven.com/database-question-answer/mssql-question-answer/change-date-format-mmddyy-to-ddmmyy-using-query.html' rel='bookmark' title='Permanent Link: Change date format mm/dd/yy to dd/mm/yy using query?'>Change date format mm/dd/yy to dd/mm/yy using query?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Q. Here is the scenario:</p>
<blockquote>
<div id="_mcePaste">declare @tt table(col1 varchar(10), joinexp varchar(100))</div>
<div id="_mcePaste">insert into @tt</div>
<div id="_mcePaste">select &#8216;c1&#8242;,&#8217;join table2 on table1.id = table1.id&#8217;</div>
<div id="_mcePaste">union all</div>
<div id="_mcePaste">select &#8216;c2&#8242;,&#8217;join table3 on table2.id = table1.id&#8217;</div>
<div id="_mcePaste">union all</div>
<div id="_mcePaste">select &#8216;c3&#8242;,&#8217;join table4 on table3.id = table1.id&#8217;</div>
<div id="_mcePaste">union all</div>
<div id="_mcePaste">select &#8216;c4&#8242;,&#8217;join table5 on table5.id = table1.id&#8217;</div>
<div id="_mcePaste">union all</div>
<div id="_mcePaste">select &#8216;c5&#8242;,NULL</div>
<div id="_mcePaste">union all</div>
<div id="_mcePaste">select &#8216;c6&#8242;,NULL</div>
<div id="_mcePaste">declare @str varchar(1000)</div>
<div id="_mcePaste">set @str = &#8216;Select c1,c4,c5,c8,c9 from table1&#8242;</div>
<p>declare @tt table(col1 varchar(10), joinexp varchar(100))insert into @ttselect &#8216;c1&#8242;,&#8217;join table2 on table1.id = table1.id&#8217;union allselect &#8216;c2&#8242;,&#8217;join table3 on table2.id = table1.id&#8217;union allselect &#8216;c3&#8242;,&#8217;join table4 on table3.id = table1.id&#8217;union allselect &#8216;c4&#8242;,&#8217;join table5 on table5.id = table1.id&#8217;union allselect &#8216;c5&#8242;,NULLunion allselect &#8216;c6&#8242;,NULL<br />
declare @str varchar(1000)set @str = &#8216;Select c1,c4,c5,c8,c9 from table1&#8242;</p></blockquote>
<p>Now, in above create dynamic query with dynamic join with the subsequent column from C1,c4 etc.</p>
<blockquote><p>Ans: Select @str = @str + space(1) + joinexp</p>
<p>from @tt</p>
<p>where CharIndex(col1,@str) &gt; 0 and joinexp &lt;&gt;&#8221;</p>
<p>Select @str</p></blockquote>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Create+dynamic+query+with+dynamic+joins+http%3A%2F%2Ftinyurl.com%2F6f85nnc" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Create+dynamic+query+with+dynamic+joins+http%3A%2F%2Ftinyurl.com%2F6f85nnc" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=656&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/database-question-answer/write-query-to-get-custom-results.html' rel='bookmark' title='Permanent Link: Write query to get custom results'>Write query to get custom results</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-db2-question-answer/what-is-the-syntax-required-for-the-creation-of-a-cursor.html' rel='bookmark' title='Permanent Link: What is the syntax required for the creation of a cursor?'>What is the syntax required for the creation of a cursor?</a></li>
<li><a href='http://interview.msdotnetheaven.com/database-question-answer/mssql-question-answer/change-date-format-mmddyy-to-ddmmyy-using-query.html' rel='bookmark' title='Permanent Link: Change date format mm/dd/yy to dd/mm/yy using query?'>Change date format mm/dd/yy to dd/mm/yy using query?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/database-question-answer/create-dynamic-query-with-dynamic-joins.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Can I inherit two difference classes to partial classes?</title>
		<link>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/asp-net-interview-questions/can-i-inherit-two-difference-classes-to-partial-classes.html</link>
		<comments>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/asp-net-interview-questions/can-i-inherit-two-difference-classes-to-partial-classes.html#comments</comments>
		<pubDate>Mon, 25 Jan 2010 14:50:50 +0000</pubDate>
		<dc:creator>smartbrain</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[Company asked interview questions]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[RSystems]]></category>
		<category><![CDATA[interview questions and answers]]></category>
		<category><![CDATA[partial class]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=648</guid>
		<description><![CDATA[Q. Can I inherit two difference classes to partial classes? Following is the whole scenario of this question:
I have two classes XYZ and ABC and two partial classes  of class myClass now is it possible:
partial class myClass : XYZ
{
}
partial class myClass : ABC
{
}
Ans:  This question I have asked in RSystems, Noida and I am sharing hereunder with you :
We can&#8217;t inherit two difference classes to partial class because in C# multiple inheritance is not possible using classes.
The main reason is in C# we cant do the following:
class myClass : XYZ, ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html' rel='bookmark' title='Permanent Link: What are Classes and structures'>What are Classes and structures</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/csharp-interview-questions/when-you-inherit-a-protected-class-level-variablewho-is-it-available-to.html' rel='bookmark' title='Permanent Link: When you inherit a protected-class-level variable,who is it available to?'>When you inherit a protected-class-level variable,who is it available to?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/can-we-store-filtered-dataview-in-viewstate.html' rel='bookmark' title='Permanent Link: Can we store filtered DataView in ViewState?'>Can we store filtered DataView in ViewState?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Q. Can I inherit two difference classes to partial classes? Following is the whole scenario of this question:</p>
<p>I have two classes XYZ and ABC and two partial classes  of class myClass now is it possible:</p>
<blockquote><p>partial class myClass : XYZ</p>
<p>{</p>
<p>}</p>
<p>partial class myClass : ABC</p>
<p>{</p>
<p>}</p></blockquote>
<p><strong><span style="text-decoration: underline;">Ans</span></strong>:  This question I have asked in RSystems, Noida and I am sharing hereunder with you :</p>
<p>We can&#8217;t inherit two difference classes to partial class because in C# multiple inheritance is not possible using classes.</p>
<p>The main reason is in C# we cant do the following:</p>
<blockquote><p>class myClass : XYZ, ABC</p>
<p>{</p>
<p>}</p></blockquote>
<p>It will throw an error while we compile the code.</p>
<address><em>Note: if anyone has better views for this question please share.</em></address>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Can+I+inherit+two+difference+classes+to+partial+classes%3F+http%3A%2F%2Ftinyurl.com%2F5t4bx47" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Can+I+inherit+two+difference+classes+to+partial+classes%3F+http%3A%2F%2Ftinyurl.com%2F5t4bx47" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=648&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/what-are-classes-and-structures.html' rel='bookmark' title='Permanent Link: What are Classes and structures'>What are Classes and structures</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/csharp-interview-questions/when-you-inherit-a-protected-class-level-variablewho-is-it-available-to.html' rel='bookmark' title='Permanent Link: When you inherit a protected-class-level variable,who is it available to?'>When you inherit a protected-class-level variable,who is it available to?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/can-we-store-filtered-dataview-in-viewstate.html' rel='bookmark' title='Permanent Link: Can we store filtered DataView in ViewState?'>Can we store filtered DataView in ViewState?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/asp-net-interview-questions/can-i-inherit-two-difference-classes-to-partial-classes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can we store filtered DataView in ViewState?</title>
		<link>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/can-we-store-filtered-dataview-in-viewstate.html</link>
		<comments>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/can-we-store-filtered-dataview-in-viewstate.html#comments</comments>
		<pubDate>Mon, 25 Jan 2010 13:16:05 +0000</pubDate>
		<dc:creator>smartbrain</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[Microsoft .Net]]></category>
		<category><![CDATA[dataview]]></category>
		<category><![CDATA[interview questions]]></category>
		<category><![CDATA[microsoft interview questions]]></category>
		<category><![CDATA[Viewstate]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=643</guid>
		<description><![CDATA[The question is asked in RSystems, Noida and I am sharing the same with you, my asnwer is as follows, if anyone have idea or more depth in answer please share where:
We can store only objects of the following types:
1. string
2. integers
3. boolean
4. Array
5. ArrayList
6. Hash tables
7. Custom types etc.
Apart from above we can share some other types too but the class must be serialized.
In view of above theory, we can say &#8216;yes, we can store DataView in ViewState for serialized class.
  Tweet This Post

Related posts:What is a view?
What ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-db2-question-answer/what-is-a-view.html' rel='bookmark' title='Permanent Link: What is a view?'>What is a view?</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-db2-question-answer/what-is-a-tablespace.html' rel='bookmark' title='Permanent Link: What is a tablespace?'>What is a tablespace?</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-db2-question-answer/what-is-a-declarations-generator-dclgen.html' rel='bookmark' title='Permanent Link: What is a Declarations Generator (DCLGEN)?'>What is a Declarations Generator (DCLGEN)?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">The question is asked in <strong>RSystems, Noida</strong> and I am sharing the same with you, my asnwer is as follows, if anyone have idea or more depth in answer please share where:</div>
<div id="_mcePaste">We can store only objects of the following types:</div>
<div id="_mcePaste">1. string</div>
<div id="_mcePaste">2. integers</div>
<div id="_mcePaste">3. boolean</div>
<div id="_mcePaste">4. Array</div>
<div id="_mcePaste">5. ArrayList</div>
<div id="_mcePaste">6. Hash tables</div>
<div id="_mcePaste">7. Custom types etc.</div>
<div id="_mcePaste">Apart from above we can share some other types too but the class must be serialized.</div>
<div id="_mcePaste">In view of above theory, we can say &#8216;yes, we can store DataView in ViewState for serialized class.</div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Can+we+store+filtered+DataView+in+ViewState%3F+http%3A%2F%2Ftinyurl.com%2F6ztdgax" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Can+we+store+filtered+DataView+in+ViewState%3F+http%3A%2F%2Ftinyurl.com%2F6ztdgax" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=643&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-db2-question-answer/what-is-a-view.html' rel='bookmark' title='Permanent Link: What is a view?'>What is a view?</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-db2-question-answer/what-is-a-tablespace.html' rel='bookmark' title='Permanent Link: What is a tablespace?'>What is a tablespace?</a></li>
<li><a href='http://interview.msdotnetheaven.com/mainframe-question-and-answers/mainframe-db2-question-answer/what-is-a-declarations-generator-dclgen.html' rel='bookmark' title='Permanent Link: What is a Declarations Generator (DCLGEN)?'>What is a Declarations Generator (DCLGEN)?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/can-we-store-filtered-dataview-in-viewstate.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can I get the date of Last Monday of specified week?</title>
		<link>http://interview.msdotnetheaven.com/database-question-answer/how-can-i-get-the-date-of-last-monday-of-specified-week.html</link>
		<comments>http://interview.msdotnetheaven.com/database-question-answer/how-can-i-get-the-date-of-last-monday-of-specified-week.html#comments</comments>
		<pubDate>Fri, 22 Jan 2010 16:50:47 +0000</pubDate>
		<dc:creator>smartbrain</dc:creator>
				<category><![CDATA[Database Questions]]></category>
		<category><![CDATA[MsSql Server]]></category>
		<category><![CDATA[sql interview question]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=640</guid>
		<description><![CDATA[The query is asked in my recent interview and the same I want to share with you. If anyone has better solution(corrected by Sandeep Walia)  please share here:
declare @dt datetime
set @dt=&#8217;1/1/2010&#8242; &#8211;Want to know January&#8217;s Last Monday Date
SELECT dateadd(d,-datepart(dw,DATEADD(d, -datepart(d,dateadd(mm,1,@dt)),dateadd(mm,1,@dt))-1)+1,DATEADD(d, -datepart(d,dateadd(mm,1,@dt)),dateadd(mm,1,@dt)))
  Tweet This Post

Related posts:Write query to get custom results
Change date format mm/dd/yy to dd/mm/yy using query?
Create dynamic query with dynamic joins



Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/database-question-answer/write-query-to-get-custom-results.html' rel='bookmark' title='Permanent Link: Write query to get custom results'>Write query to get custom results</a></li>
<li><a href='http://interview.msdotnetheaven.com/database-question-answer/mssql-question-answer/change-date-format-mmddyy-to-ddmmyy-using-query.html' rel='bookmark' title='Permanent Link: Change date format mm/dd/yy to dd/mm/yy using query?'>Change date format mm/dd/yy to dd/mm/yy using query?</a></li>
<li><a href='http://interview.msdotnetheaven.com/database-question-answer/create-dynamic-query-with-dynamic-joins.html' rel='bookmark' title='Permanent Link: Create dynamic query with dynamic joins'>Create dynamic query with dynamic joins</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The query is asked in my recent interview and the same I want to share with you. If anyone has better solution(corrected by Sandeep Walia)  please share here:</p>
<blockquote><p>declare @dt datetime</p>
<p>set @dt=&#8217;1/1/2010&#8242; &#8211;Want to know January&#8217;s Last Monday Date</p>
<p>SELECT dateadd(d,-datepart(dw,DATEADD(d, -datepart(d,dateadd(mm,1,@dt)),dateadd(mm,1,@dt))-1)+1,DATEADD(d, -datepart(d,dateadd(mm,1,@dt)),dateadd(mm,1,@dt)))</p></blockquote>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=How+can+I+get+the+date+of+Last+Monday+of+specified+week%3F+http%3A%2F%2Ftinyurl.com%2F4upd42e" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=How+can+I+get+the+date+of+Last+Monday+of+specified+week%3F+http%3A%2F%2Ftinyurl.com%2F4upd42e" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=640&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/database-question-answer/write-query-to-get-custom-results.html' rel='bookmark' title='Permanent Link: Write query to get custom results'>Write query to get custom results</a></li>
<li><a href='http://interview.msdotnetheaven.com/database-question-answer/mssql-question-answer/change-date-format-mmddyy-to-ddmmyy-using-query.html' rel='bookmark' title='Permanent Link: Change date format mm/dd/yy to dd/mm/yy using query?'>Change date format mm/dd/yy to dd/mm/yy using query?</a></li>
<li><a href='http://interview.msdotnetheaven.com/database-question-answer/create-dynamic-query-with-dynamic-joins.html' rel='bookmark' title='Permanent Link: Create dynamic query with dynamic joins'>Create dynamic query with dynamic joins</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/database-question-answer/how-can-i-get-the-date-of-last-monday-of-specified-week.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can I create a Singleton class by using public constructor?</title>
		<link>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html</link>
		<comments>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html#comments</comments>
		<pubDate>Mon, 11 Jan 2010 15:39:23 +0000</pubDate>
		<dc:creator>meghna</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Microsoft .Net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Interview question]]></category>
		<category><![CDATA[singleton]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=633</guid>
		<description><![CDATA[I have also asked a tricky question like this:
Can we create a singleton class using public constructor?
Simply answer is yes.
Practically, many of us aware that we can create a singleton class by using private constructor an creating a property, but we can create a singleton class by using public constructor as folows:
static void Main(string[] args)
{
try
{
Singleton obj3 = new Singleton2();
Singleton obj4 = new Singleton2();
Console.Read();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.Read();
}
}
static void Main(string[] args)
{
try
{
Singleton obj3 = new Singleton2();
Singleton obj4 = new Singleton2();
Console.Read();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.Read();
}
}
  Tweet This Post

Related posts:Is it possible to create constructor for an ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/general-interview-stuffs/is-it-possible-to-create-constructor-for-an-abstract-class.html' rel='bookmark' title='Permanent Link: Is it possible to create constructor for an Abstract class?'>Is it possible to create constructor for an Abstract class?</a></li>
<li><a href='http://interview.msdotnetheaven.com/crystal-report/difference-between-clone-close-and-dispose-methods-of-crystal-report.html' rel='bookmark' title='Permanent Link: Difference between Clone, Close and Dispose methods of Crystal Report?'>Difference between Clone, Close and Dispose methods of Crystal Report?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html' rel='bookmark' title='Permanent Link: Define Lambda expressions'>Define Lambda expressions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have also asked a tricky question like this:</p>
<p>Can we create a singleton class using public constructor?</p>
<p><span style="text-decoration: underline;">Simply answer is yes.</span></p>
<p>Practically, many of us aware that we can create a singleton class by using private constructor an creating a property, but we can create a singleton class by using public constructor as folows:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">static void Main(string[] args)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">try</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Singleton obj3 = new Singleton2();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Singleton obj4 = new Singleton2();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Console.Read();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">catch (Exception ex)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Console.WriteLine(ex.ToString());</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Console.Read();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<blockquote><p>static void Main(string[] args)</p>
<p>{</p>
<p>try</p>
<p>{</p>
<p>Singleton obj3 = new Singleton2();</p>
<p>Singleton obj4 = new Singleton2();</p>
<p>Console.Read();</p>
<p>}</p>
<p>catch (Exception ex)</p>
<p>{</p>
<p>Console.WriteLine(ex.ToString());</p>
<p>Console.Read();</p>
<p>}</p>
<p>}</p></blockquote>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=How+can+I+create+a+Singleton+class+by+using+public+constructor%3F+http%3A%2F%2Ftinyurl.com%2Fy9wkopf" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=How+can+I+create+a+Singleton+class+by+using+public+constructor%3F+http%3A%2F%2Ftinyurl.com%2Fy9wkopf" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=633&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/general-interview-stuffs/is-it-possible-to-create-constructor-for-an-abstract-class.html' rel='bookmark' title='Permanent Link: Is it possible to create constructor for an Abstract class?'>Is it possible to create constructor for an Abstract class?</a></li>
<li><a href='http://interview.msdotnetheaven.com/crystal-report/difference-between-clone-close-and-dispose-methods-of-crystal-report.html' rel='bookmark' title='Permanent Link: Difference between Clone, Close and Dispose methods of Crystal Report?'>Difference between Clone, Close and Dispose methods of Crystal Report?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html' rel='bookmark' title='Permanent Link: Define Lambda expressions'>Define Lambda expressions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Define Lambda expressions</title>
		<link>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html</link>
		<comments>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html#comments</comments>
		<pubDate>Wed, 09 Dec 2009 13:55:02 +0000</pubDate>
		<dc:creator>smartbrain</dc:creator>
				<category><![CDATA[LINQ]]></category>
		<category><![CDATA[interview questions]]></category>
		<category><![CDATA[Lambda Expression]]></category>

		<guid isPermaLink="false">http://interview.msdotnetheaven.com/?p=622</guid>
		<description><![CDATA[A Lambda expression is nothing but an Anonymous Function, can contain expressions and statements. Lambda expressions can be used mostly to create delegates or expression tree types. Lambda expression uses lambda operator => and read as &#8216;goes to&#8217; operator.
Left side of this operator specifies the input parameters and contains the expression or statement block at the right side. 
Example: myExp = myExp/10; 
Now, let see how we can assign the above to a delegate and create an expression tree: 
delegate int myDel(int intMyNum);
        ...


Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/what-is-a-lambda-expression.html' rel='bookmark' title='Permanent Link: What is a Lambda expression?'>What is a Lambda expression?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html' rel='bookmark' title='Permanent Link: How can I create a Singleton class by using public constructor?'>How can I create a Singleton class by using public constructor?</a></li>
<li><a href='http://interview.msdotnetheaven.com/crystal-report/difference-between-clone-close-and-dispose-methods-of-crystal-report.html' rel='bookmark' title='Permanent Link: Difference between Clone, Close and Dispose methods of Crystal Report?'>Difference between Clone, Close and Dispose methods of Crystal Report?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A <strong>Lambda expression</strong> is nothing but an Anonymous Function, can contain expressions and statements. Lambda expressions can be used mostly to create delegates or expression tree types. Lambda expression uses lambda operator => and read as &#8216;goes to&#8217; operator.</p>
<p>Left side of this operator specifies the input parameters and contains the expression or statement block at the right side. </p>
<p><strong>Example: </strong>myExp = myExp/10; </p>
<p>Now, let see how we can assign the above to a delegate and create an expression tree: </p>
<p><code>delegate int myDel(int intMyNum);<br />
        static void Main(string[] args)<br />
        {<br />
            //assign lambda expression to a delegate:<br />
            myDel myDelegate = myExp =&gt; myExp / 10;<br />
            int intRes = myDelegate(110);<br />
            Console.WriteLine("Output {0}", intRes);<br />
            Console.ReadLine();<br />
            //Create an expression tree type<br />
            //This needs System.Linq.Expressions<br />
            Expression&lt;myDel&gt; myExpDel = myExp =&gt; myExp /10;<br />
        }</code></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Define+Lambda+expressions+http%3A%2F%2Ftinyurl.com%2F4s2wa3d" title="Post to Twitter"><img class="nothumb" src="http://interview.msdotnetheaven.com/wp-content/plugins/tweet-this/icons/de/twitter/de/tt-twitter-micro4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Define+Lambda+expressions+http%3A%2F%2Ftinyurl.com%2F4s2wa3d" title="Post to Twitter">Tweet This Post</a></p></div><img src="http://interview.msdotnetheaven.com/?ak_action=api_record_view&id=622&type=feed" alt="" />

<p>Related posts:<ol><li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/what-is-a-lambda-expression.html' rel='bookmark' title='Permanent Link: What is a Lambda expression?'>What is a Lambda expression?</a></li>
<li><a href='http://interview.msdotnetheaven.com/microsoft-net-interview-questions/how-can-i-create-a-singleton-class-by-using-public-constructor.html' rel='bookmark' title='Permanent Link: How can I create a Singleton class by using public constructor?'>How can I create a Singleton class by using public constructor?</a></li>
<li><a href='http://interview.msdotnetheaven.com/crystal-report/difference-between-clone-close-and-dispose-methods-of-crystal-report.html' rel='bookmark' title='Permanent Link: Difference between Clone, Close and Dispose methods of Crystal Report?'>Difference between Clone, Close and Dispose methods of Crystal Report?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://interview.msdotnetheaven.com/microsoft-net-interview-questions/linq/define-lambda-expressions.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

