PC Review


Reply
Thread Tools Rate Thread

add null to collectionbase derivation

 
 
John B
Guest
Posts: n/a
 
      15th Feb 2005
I changed my code to replace an arraylist with a collection derived from
collectionbase to get type-safe calls. Now though, I cannot seem to add a
null value to the collection, where I could previously with an arraylist. Am
I doing something wrong? Is there a way around it?

Thx


 
Reply With Quote
 
 
 
 
Chad Z. Hower aka Kudzu
Guest
Posts: n/a
 
      15th Feb 2005
"John B" <(E-Mail Removed)> wrote in
news:fuWdnVQvRPc9bIzfRVn-(E-Mail Removed):
> I changed my code to replace an arraylist with a collection derived from
> collectionbase to get type-safe calls. Now though, I cannot seem to add
> a null value to the collection, where I could previously with an
> arraylist. Am I doing something wrong? Is there a way around it?


Stating actual errors I've found is quite useful when requesting help.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 
Reply With Quote
 
John B
Guest
Posts: n/a
 
      15th Feb 2005
Here is the class:

public class ControlCollection : CollectionBase
{
public void Add(Control control)
{
base.List.Add(control);
...
}

....
}

and here is the error when control is null:

ArguementNullException was unhandled
Value can not be null.
Parameter name: value

Thanks
---

"Chad Z. Hower aka Kudzu" <(E-Mail Removed)> wrote in message
news:Xns95FE5E021C4F6cpub@127.0.0.1...
> "John B" <(E-Mail Removed)> wrote in
> news:fuWdnVQvRPc9bIzfRVn-(E-Mail Removed):
> > I changed my code to replace an arraylist with a collection derived from
> > collectionbase to get type-safe calls. Now though, I cannot seem to add
> > a null value to the collection, where I could previously with an
> > arraylist. Am I doing something wrong? Is there a way around it?

>
> Stating actual errors I've found is quite useful when requesting help.
>
>
> --
> Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
> "Programming is an art form that fights back"
>
> Get your ASP.NET in gear with IntraWeb!
> http://www.atozed.com/IntraWeb/




----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
Chad Z. Hower aka Kudzu
Guest
Posts: n/a
 
      15th Feb 2005
"John B" <(E-Mail Removed)> wrote in news:42121925$1_2@127.0.0.1:
> ArguementNullException was unhandled
> Value can not be null.
> Parameter name: value


This is coming from CollectionBase - it probably does not allow nulls as part
of its functionality, which would make sense for a collection.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 
Reply With Quote
 
Ollie Riches
Guest
Posts: n/a
 
      15th Feb 2005
you can't add a null to strongly typed collection, it is only going to
accept objects of the type required, a null value does not have a typed
defined.

HTH

Ollie Riches


"John B" <(E-Mail Removed)> wrote in message
news:42121925$1_2@127.0.0.1...
> Here is the class:
>
> public class ControlCollection : CollectionBase
> {
> public void Add(Control control)
> {
> base.List.Add(control);
> ...
> }
>
> ...
> }
>
> and here is the error when control is null:
>
> ArguementNullException was unhandled
> Value can not be null.
> Parameter name: value
>
> Thanks
> ---
>
> "Chad Z. Hower aka Kudzu" <(E-Mail Removed)> wrote in message
> news:Xns95FE5E021C4F6cpub@127.0.0.1...
> > "John B" <(E-Mail Removed)> wrote in
> > news:fuWdnVQvRPc9bIzfRVn-(E-Mail Removed):
> > > I changed my code to replace an arraylist with a collection derived

from
> > > collectionbase to get type-safe calls. Now though, I cannot seem to

add
> > > a null value to the collection, where I could previously with an
> > > arraylist. Am I doing something wrong? Is there a way around it?

> >
> > Stating actual errors I've found is quite useful when requesting help.
> >
> >
> > --
> > Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
> > "Programming is an art form that fights back"
> >
> > Get your ASP.NET in gear with IntraWeb!
> > http://www.atozed.com/IntraWeb/

>
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet

News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+

Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption

=----


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allow any derivation of a generic class Arthur Dent Microsoft VB .NET 2 30th Nov 2007 05:31 PM
Compiler bug with __event and derivation Edward Diener Microsoft VC .NET 1 3rd Aug 2005 03:16 AM
Derivation of min and max values =?Utf-8?B?YmFuZHkyMDAw?= Microsoft Excel Programming 16 1st Apr 2005 01:17 AM
DataRow class derivation André Fereau Microsoft C# .NET 6 24th Mar 2005 09:40 PM
Derivation distance and interfaces Andreas Damm Microsoft C# .NET 0 4th Mar 2004 11:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:54 AM.