2 using System
.Collections
.Generic
;
8 public class WvMoniker
<T
>
10 static List
<WvMoniker
<T
>> registry
= new List
<WvMoniker
<T
>>();
12 Func
<string,object,T
> func
;
14 public static WvMoniker
<T
>
15 register(string prefix
, Func
<string,object,T
> func
)
17 return new WvMoniker
<T
>(prefix
, func
);
20 public WvMoniker(string prefix
, Func
<string,object,T
> func
)
27 // probably nobody will ever call this
28 public void unregister()
30 registry
.Remove(this);
33 public static WvMoniker
<T
> find(string prefix
)
35 foreach (WvMoniker
<T
> m
in registry
)
36 if (m
.prefix
== prefix
)
41 public static T
create(string moniker
, object o
)
43 int pos
= moniker
.IndexOf(':');
44 string prefix
, suffix
;
47 prefix
= moniker
.Substring(0, pos
);
48 suffix
= moniker
.Substring(pos
+1);
56 WvMoniker
<T
> m
= find(prefix
);
60 return m
.func(suffix
, o
);
63 public static T
create(string moniker
)
65 return create(moniker
, null);