blog community

Welcome to blog community Sign in | Join | Help
in Search

Willem Meints

Deleting browser cookies ... Best done with a glass of milk

.NET is not always that useful

Please don't start e-mailing me that I am wrong here, for the most part .NET is a great framework and it contains a lot of useful components. Except for the GridTablesFactory class. I have no idea what it does and appearantly Microsoft isn't so sure either.

Published Monday, August 04, 2008 8:00 AM by willemm
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Wouter said:

It is clear to me that you underestimate the complexity of creating an array of objects, which is the sole task of this highly important class (hey, at least it is documented correctly). From Reflector: public static DataGridTableStyle[] CreateGridTables(DataGridTableStyle gridTable, object dataSource, string dataMember, BindingContext bindingManager) { return new DataGridTableStyle[] { gridTable }; } Haha, all parameters are unused except the first, which is returned as an array. This is complex science, didn't you know? Another nice feature that you should not underestimate the importance of is the fact that it is a static method. This way we will not be able to return, say, a different array using a virtual method, if you feel that this array is not array-ish enough or something. Also, the constructor is private, so it's almost like a singleton. I think they should rename the class to 'HighlyOptimizedAlmostSingletonArrayManufacturerForDataGridTableStyleObjects'
August 6, 2008 1:05 PM
 

willemm said:

Moreover a factory class is a design-pattern and as such much cooler than just saying DataGridTableStyle[] styles = new DataGridTableStyle { gridTable }; in your code.

It's like saying DataGridTableStyle[] styles = Sequence.Repeat<DataGridTableStyle>(gridTable,1).ToArray();

August 6, 2008 1:55 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems