1. 9dj82nds

    Accessing reflection generics and creating new instances of them?

    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...
  2. Sinh_R

    Generic Method which returns either MemoryStream or Byte array

    Hi, I need some guidance regarding the problem I am facing. PROBLEM: I am currently working on MinIO object storage (similar to Azure Blob and AWS S3) and I am currently trying to implement a method which will download the files uploaded in my local cloud storage. For that I want to create a...
  3. C

    C# Generic collections - Get list of sub level child items from parent object

    Public class viewmodel { public string ID {get;set;} public String name{get;set;} public List<child1>{get;set;} } public class child1 { public string C1ID {get;set;} public String C1name{get;set;} public List<child2>{get;set;} } public...
  4. Socarsky

    Convert a List<object> to a string[,] 2D array

    I am in a difficulty to convert a List that is class object which populated from database, so far so good to have that list of object but I need its string[,] (2D) array as converted to apply a method which helps to get an print output. private void dateTimePicker1_ValueChanged(object sender...
  5. tobias233

    Question How can I pass multiple type variables to generic type variable T?

    Hello :joyous:, I am doing C# for a half year now. Today I want to call a method like this in a class with the name "A": public T TheMethod<T>(IRestResponse response) { ... } At compile time, T isn't known. var theType = typeof(B); So I tried the following: var gMethod=...
Top Bottom