Validating List<type>

Topics: Building and extending application blocks, General discussion, Validation Application Block
Apr 5, 2010 at 9:34 PM

I was curious if it is possible or if there are any examples available, demonstrating the capability of validating something such as List<type>? I've going through documentation that I could find online, but I haven't had any luck so far. 

Currently, my config file is set up as follows.

Validation Application Block

                Class1 (type)


                                 some property 1

                                 some property 2




                             some property 3



                             some other property 1

                             Class1 (exist as a property in this class; e.g. List<Class1>)

                             some other property 2

Does anyone have any ideas?

Apr 5, 2010 at 11:39 PM

You would use an ObjectCollectionValidator.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Apr 6, 2010 at 8:08 PM

Ok. Are there any examples available showing what I am trying to accomplish?

Apr 6, 2010 at 11:50 PM

Decorate your property with the ObjectCollectionValidator attribute and specifying the type it should validate.


public class Class2
        public List<Class1> Class1Members
        { get; set;  }

Or in the case where you specify it in the config, simply select the property you want to validate and assign an ObjectCollectionValidator to it.  Select the appropriate type for the TargetType property of the ObjectCollectionValidator.

With this, when you validate an instance of Class2, it would also perform validation on each member of the Class1Members property.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Apr 7, 2010 at 12:43 PM

Thanks! That worked perfectly.

Jul 11, 2011 at 5:05 AM

How to accomplish ObjectCollectionValidator using EnterpriseLibrary in wpf MVVM application and when validation rulesets are placed in a Configuration file rather than codebehind.Please send me an example to implement the ObjectCollectionValidator if possible?My email id is

Jul 11, 2011 at 11:53 AM


We are looking on this one. We'll keep you posted. 


Noel Angelo Bolasoc
Global Technology and Solutions
Avanade, Inc.

Jul 12, 2011 at 7:47 AM

I can't provide you a better example for this one as honestly I also had hard time achieving the same. I'm saying that it this is not be achievable, but I guess we are missing something here.


Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.