How to register a component in XML that is a concrete generic where the generic is an array?

2 views
Skip to first unread message

George Mauer

unread,
Oct 13, 2008, 10:00:31 AM10/13/08
to Castle Project Development List
This is a simple issue of me not knowing proper Xml syntax. In castle
windsor I can duplicate this line of code:

IoC.Container.AddComponent<IInputRequestedDialog<string>,
SealsInputDialog>("seals");
With this Xml:

<component id="seals"
service="MyApp.InputRequestedDialog`1[[System.String]], MyApp"
type="MyApp.SealsInputDialog, MyApp" />
But what if the concrete generic is a string array rather than a
string? How do I xml-ize the following?

IoC.Container.AddComponent<IInputRequestedDialog<string[]>,
SealsInputDialog>("seals");

<a href="http://stackoverflow.com/questions/192717/what-is-standard-
clr-xml-for-a-concrete-generic-that-is-an-array">If anyone wants
stackoveflow points, I've cross posted the question there.</a>

Ken Egozi

unread,
Oct 13, 2008, 10:12:06 AM10/13/08
to castle-pro...@googlegroups.com
I just did

Console.WriteLine(typeof (IFoo<string[]>).FullName);

the output was:

IFoo`1[[System.String[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

so I guess

 service="MyApp.InputRequestedDialog`1[System.String[] ], MyApp"

should be working,
and if not,

 service="MyApp.InputRequestedDialog`1[[System.String[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MyApp"

must do the trick

George Mauer

unread,
Oct 13, 2008, 10:51:29 AM10/13/08
to Castle Project Development List
Awesome! Didn't even know that I could find these out using this
method. Thanks a lot.

On Oct 13, 9:12 am, "Ken Egozi" <egoz...@gmail.com> wrote:
> I just did
>
> Console.WriteLine(typeof (IFoo<string[]>).FullName);
>
> the output was:
>
> IFoo`1[[System.String[], mscorlib, Version=2.0.0.0
> , Culture=neutral, PublicKeyToken=b77a5c561934e089]]
>
> so I guess
>
>  service="MyApp.InputRequestedDialog`1[System.String[] ], MyApp"
>
> should be working,
> and if not,
>
>  service="MyApp.InputRequestedDialog`1[[System.String[], mscorlib, Version=
> 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MyApp"
>
> must do the trick
>
>
>
> On Mon, Oct 13, 2008 at 4:00 PM, George Mauer <gma...@gmail.com> wrote:
>
> > This is a simple issue of me not knowing proper Xml syntax. In castle
> > windsor I can duplicate this line of code:
>
> > IoC.Container.AddComponent<IInputRequestedDialog<string>,
> > SealsInputDialog>("seals");
> > With this Xml:
>
> > <component id="seals"
> >    service="MyApp.InputRequestedDialog`1[[System.String]], MyApp"
> >    type="MyApp.SealsInputDialog, MyApp" />
> > But what if the concrete generic is a string array rather than a
> > string? How do I xml-ize the following?
>
> > IoC.Container.AddComponent<IInputRequestedDialog<string[]>,
> > SealsInputDialog>("seals");
>
> > <a href="http://stackoverflow.com/questions/192717/what-is-standard-
> > clr-xml-for-a-concrete-generic-that-is-an-array<http://stackoverflow.com/questions/192717/what-is-standard-clr-xml-fo...>">If
Reply all
Reply to author
Forward
0 new messages