9dj82nds
Member
- Joined
- Nov 1, 2022
- Messages
- 10
- Programming Experience
- 5-10
			
				C#:
			
		
		
		var types = Assembly.GetExecutingAssembly().GetTypes().Where(t => String.Equals(t.Namespace, "SomeNamespace", StringComparison.Ordinal)).ToArray();
foreach (Type T in types)
{
    //Neither of these will work
    var foo = Activator.CreateInstance(typeof(`What would I put here?`).MakeGenericType(T));
    var bar = Activator.CreateInstance(T.GetType().MakeGenericType(T));I'm trying to work my way around the above code in order to generate the objects within a namespace, so I can use it for a generic system down the line:
			
				C#:
			
		
		
		    public class GenericObject<T>
    {
        public T[] GetData() => DeserializeJson.GetFiles<T>(typeof(T).Name);
        public GenericTab<T> tab;
    }1. Is there any way I can do something like `new GenericObject<typeof(T)>()`
2. If not, is there any way I can get the classes from the `SomeNamespace` and assign them to `GenericObjects<T>` in a different way?
 
	 
 
		 
 
		 
 
		