<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Implementing CollectionBase</title>
	<atom:link href="http://www.mattberther.com/2004/09/05/implementing-collectionbase/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/</link>
	<description>Agile Manager and Occasional Code Monkey</description>
	<lastBuildDate>Sun, 21 Feb 2010 22:01:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: junior</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-166530</link>
		<dc:creator>junior</dc:creator>
		<pubDate>Tue, 22 Sep 2009 07:57:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-166530</guid>
		<description>very good example. very helpful..</description>
		<content:encoded><![CDATA[<p>very good example. very helpful..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: heracles maroudas</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-647</link>
		<dc:creator>heracles maroudas</dc:creator>
		<pubDate>Mon, 17 Apr 2006 14:49:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-647</guid>
		<description>Strongly Typed CollectionBase Class
			Eric Maroudas
			Creates a Strongly Typed Collection Base Class Implementation.
			classCollectionBase
			
				Expansion
			
		
		
			
				
					ClassName
					Replace with your collection base class name.
					className
				
				
					TypeName
					Replace with your custom type class.
					yourType
				
				
					ItemName
					Replace with an item name of your choice
					item
				
			
			
				 
				{	
					#region Implemantation
					
					public int Add($TypeName$ $ItemName$)
					{
						return ((IList)this).Add((object)$ItemName$);
					}
					
					public void Remove($TypeName$ $ItemName$)
					{
						((IList)this).Remove((object)$ItemName$);
					}
					
					public void Insert(int index, $TypeName$ $ItemName$)
					{
						((IList)this).Insert(index, (object)$ItemName$);
					}
					
					public bool Contains($TypeName$ $ItemName$)
					{
						return ((IList)this).Contains((object)$ItemName$);
					}
					
					public int IndexOf($TypeName$ $ItemName$)
					{
						return ((IList)this).IndexOf((object)$ItemName$);
					}
					
					public void CopyTo($TypeName$[] $ItemName$Array, int index)
					{
						((ICollection)this).CopyTo($ItemName$Array, index);
					}
					
					public $TypeName$ this[int index]
					{
						get { return ($TypeName$)((IList)this)[index]; }
						set { ((IList)this)[index] = value; }
					}
					
					#endregion Implemantation
					
					#region IEnumerable Members
					
					public new IEnumerator GetEnumerator()
					{
						foreach ($TypeName$ $ItemName$ in InnerList)
						{
							yield return $ItemName$;
						}        
					}
					
					#endregion IEnumerable Members
					
					#region Overrides
					
					protected override void OnValidate(object value)
					{
						base.OnValidate(value);
						if (!(value is $TypeName$))
						{   
							throw new ArgumentException(&quot;This type only supports objects of this type.&quot;);
						}
					}
					
					#endregion Overrides
				}$end$]]&gt;</description>
		<content:encoded><![CDATA[<p>Strongly Typed CollectionBase Class<br />
			Eric Maroudas<br />
			Creates a Strongly Typed Collection Base Class Implementation.<br />
			classCollectionBase</p>
<p>				Expansion</p>
<p>					ClassName<br />
					Replace with your collection base class name.<br />
					className</p>
<p>					TypeName<br />
					Replace with your custom type class.<br />
					yourType</p>
<p>					ItemName<br />
					Replace with an item name of your choice<br />
					item</p>
<p>				{<br />
					#region Implemantation</p>
<p>					public int Add($TypeName$ $ItemName$)<br />
					{<br />
						return ((IList)this).Add((object)$ItemName$);<br />
					}</p>
<p>					public void Remove($TypeName$ $ItemName$)<br />
					{<br />
						((IList)this).Remove((object)$ItemName$);<br />
					}</p>
<p>					public void Insert(int index, $TypeName$ $ItemName$)<br />
					{<br />
						((IList)this).Insert(index, (object)$ItemName$);<br />
					}</p>
<p>					public bool Contains($TypeName$ $ItemName$)<br />
					{<br />
						return ((IList)this).Contains((object)$ItemName$);<br />
					}</p>
<p>					public int IndexOf($TypeName$ $ItemName$)<br />
					{<br />
						return ((IList)this).IndexOf((object)$ItemName$);<br />
					}</p>
<p>					public void CopyTo($TypeName$[] $ItemName$Array, int index)<br />
					{<br />
						((ICollection)this).CopyTo($ItemName$Array, index);<br />
					}</p>
<p>					public $TypeName$ this[int index]<br />
					{<br />
						get { return ($TypeName$)((IList)this)[index]; }<br />
						set { ((IList)this)[index] = value; }<br />
					}</p>
<p>					#endregion Implemantation</p>
<p>					#region IEnumerable Members</p>
<p>					public new IEnumerator GetEnumerator()<br />
					{<br />
						foreach ($TypeName$ $ItemName$ in InnerList)<br />
						{<br />
							yield return $ItemName$;<br />
						}<br />
					}</p>
<p>					#endregion IEnumerable Members</p>
<p>					#region Overrides</p>
<p>					protected override void OnValidate(object value)<br />
					{<br />
						base.OnValidate(value);<br />
						if (!(value is $TypeName$))<br />
						{<br />
							throw new ArgumentException(&#8221;This type only supports objects of this type.&#8221;);<br />
						}<br />
					}</p>
<p>					#endregion Overrides<br />
				}$end$]]&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: heracles maroudas</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-646</link>
		<dc:creator>heracles maroudas</dc:creator>
		<pubDate>Mon, 17 Apr 2006 14:49:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-646</guid>
		<description>heres a nice update for this article: a C# code snippet for vs 2005. just place the xml into a .snippet file and add to vs from the tools menus Code Snippet Manager. 

once imported type the short name classCollectionBase and press tab from within the ide...</description>
		<content:encoded><![CDATA[<p>heres a nice update for this article: a C# code snippet for vs 2005. just place the xml into a .snippet file and add to vs from the tools menus Code Snippet Manager. </p>
<p>once imported type the short name classCollectionBase and press tab from within the ide&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sudhakar</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-645</link>
		<dc:creator>Sudhakar</dc:creator>
		<pubDate>Thu, 05 May 2005 14:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-645</guid>
		<description>i want to create windows installer project in which i want to restrict the installation based on the &#039;Product serial number&#039; entered in the &#039;Customer information&#039; user interface custom dialog box. i also added the custom action and able to validate the product serial number entered. but my problem is unable to terminate the installation if user enters the wrong serial number. 

can anybody share your experience on this ?

Thanks in advance.
Sudhakar-D
chudhakar@yahoo.com</description>
		<content:encoded><![CDATA[<p>i want to create windows installer project in which i want to restrict the installation based on the &#8216;Product serial number&#8217; entered in the &#8216;Customer information&#8217; user interface custom dialog box. i also added the custom action and able to validate the product serial number entered. but my problem is unable to terminate the installation if user enters the wrong serial number. </p>
<p>can anybody share your experience on this ?</p>
<p>Thanks in advance.<br />
Sudhakar-D<br />
<a href="mailto:chudhakar@yahoo.com">chudhakar@yahoo.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Berther</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-644</link>
		<dc:creator>Matt Berther</dc:creator>
		<pubDate>Thu, 05 May 2005 12:45:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-644</guid>
		<description>It seems to me that you would need to implement the Add method to perform a check if the inner list has a count &gt;= 10 before adding.

public void Add(MyType obj)
{
    if (InnerList.Count &gt;= 10)
    {
        throw new ApplicationException(&quot;This collection can only hold 10 objects.&quot;);
    }
    Innerlist.Add(obj);
}</description>
		<content:encoded><![CDATA[<p>It seems to me that you would need to implement the Add method to perform a check if the inner list has a count &gt;= 10 before adding.</p>
<p>public void Add(MyType obj)<br />
{<br />
    if (InnerList.Count &gt;= 10)<br />
    {<br />
        throw new ApplicationException(&#8221;This collection can only hold 10 objects.&#8221;);<br />
    }<br />
    Innerlist.Add(obj);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arun</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-643</link>
		<dc:creator>arun</dc:creator>
		<pubDate>Thu, 05 May 2005 04:13:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-643</guid>
		<description>Sir
  I created collection property using collection base class.I want to limit the object added (say 10) to the collection.If it is greater than 10 i want to throw an error dialogbox.How to control the no. of objects added to a collection in design time.</description>
		<content:encoded><![CDATA[<p>Sir<br />
  I created collection property using collection base class.I want to limit the object added (say 10) to the collection.If it is greater than 10 i want to throw an error dialogbox.How to control the no. of objects added to a collection in design time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matej Rizman</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-642</link>
		<dc:creator>Matej Rizman</dc:creator>
		<pubDate>Thu, 24 Mar 2005 04:27:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-642</guid>
		<description>Chris,

I found error in VB.NET version of template. Instead of

Default Public Property aCustomer(ByVal index As Integer) As Customer

it should generate

Default Public Property Item(ByVal index As Integer) As Customer

If this property is not named &quot;Item&quot;, collection editor in PropertyGrid does not recognize generated collection as a strongly-typed collection.

Matej Rizman</description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>I found error in VB.NET version of template. Instead of</p>
<p>Default Public Property aCustomer(ByVal index As Integer) As Customer</p>
<p>it should generate</p>
<p>Default Public Property Item(ByVal index As Integer) As Customer</p>
<p>If this property is not named &#8220;Item&#8221;, collection editor in PropertyGrid does not recognize generated collection as a strongly-typed collection.</p>
<p>Matej Rizman</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Berther</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-641</link>
		<dc:creator>Matt Berther</dc:creator>
		<pubDate>Thu, 30 Sep 2004 13:20:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-641</guid>
		<description>And you&#039;re using CodeSmith to transform the template? If so, send me an email with your file as an attachment, and Ill be glad to take a look at it.</description>
		<content:encoded><![CDATA[<p>And you&#8217;re using CodeSmith to transform the template? If so, send me an email with your file as an attachment, and Ill be glad to take a look at it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Lane</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-640</link>
		<dc:creator>Chris Lane</dc:creator>
		<pubDate>Thu, 30 Sep 2004 13:17:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-640</guid>
		<description>Matt,

Doh, Sorry about that, The code I posted is an attempt at trying to convert the output of the C# file that the template creates to VB.NET, then I was going to convert the template to VB Style. 

Thank You,

Chris</description>
		<content:encoded><![CDATA[<p>Matt,</p>
<p>Doh, Sorry about that, The code I posted is an attempt at trying to convert the output of the C# file that the template creates to VB.NET, then I was going to convert the template to VB Style. </p>
<p>Thank You,</p>
<p>Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Berther</title>
		<link>http://www.mattberther.com/2004/09/05/implementing-collectionbase/comment-page-1/#comment-639</link>
		<dc:creator>Matt Berther</dc:creator>
		<pubDate>Thu, 30 Sep 2004 00:57:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=540#comment-639</guid>
		<description>Chris,

Im not sure what you&#039;re trying to do here. It looks like you&#039;re trying to combine the codesmith file with a .vb file. 

Which one are you trying to get to work?</description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>Im not sure what you&#8217;re trying to do here. It looks like you&#8217;re trying to combine the codesmith file with a .vb file. </p>
<p>Which one are you trying to get to work?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
