Re: Can a generic class re-create itself with another type
- From: Ankur <ankurpat@xxxxxxxxx>
- Date: Wed, 18 Jun 2008 07:12:20 -0700 (PDT)
On Jun 4, 9:25 pm, tadm...@xxxxxxxxx wrote:
Is it possible for aclassthat accepts agenerictype, to re-create
another instance of itself with a property type of the passedclass?
ex.
publicclassSomeClass<T>
{
private PropertyInfo[] propInfos;
private Type objectType = typeof(T);
public SomeClass()
{
propInfos = objectType.GetProperties();
foreach (PropertyInfo pinn in propInfos)
{
if (pinn.PropertyType.IsGenericType &&
pinn.PropertyType.GetGenericTypeDefinition() == typeof(SomeClass<>))
{
//Can another SomeClass<> be created here with the property's
type?
}
}
}
}
I have attacked this 10 different ways and haven't come up with
anything that works. That may be because it can't be done; has anyone
else attempted this successfully?
TIA for any help,
Terry
SELECT distinct SysObjects.[Name] as TableName, SysColumns.
[Name] as ColumnName,
SysTypes.[Name] As DataType,
SysColumns.[Length] As Length FROM SysObjects INNER JOIN
SysColumns ON SysObjects.[Id] = SysColumns.[Id]
INNER JOIN SysTypes ON SysTypes.[xtype] = SysColumns.
[xtype]
WHERE SysTypes.[Name]='image' and SysObjects.[type] = 'U'
ORDER BY SysObjects.[Name]
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES WHERE
ROUTINE_DEFINITION LIKE '%aup_Photo%' AND ROUTINE_TYPE='PROCEDURE'
ORDER BY ROUTINE_NAME
.
- References:
- Can a generic class re-create itself with another type
- From: tadmill
- Can a generic class re-create itself with another type
- Prev by Date: What is that question (?) sign after a type declaration?
- Next by Date: Re: What is that question (?) sign after a type declaration?
- Previous by thread: Re: Can a generic class re-create itself with another type
- Next by thread: Reading bytes from stdin efficiently
- Index(es):
Loading