reflection

  1. D

    Question How do I get the namespace of my .NET 7 application

    I asked this on SO and got skewered. I love SO for the answers, but asking a question is fraught with peril. I'm new here, but I'm hopeful y'all will be more forgiving and helpful. if I: dotnet new console -f netcoreapp3.1 -n four add to Program.cs Console.WriteLine("Namespace: {0}"...
  2. 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...
  3. S

    Question move data from one sql server to another.

    We just redesigned, and rewrote, our application with brand new designed database schema. My next job is to write c# code that will convert and move the data from the old database to the new database. . I'm a simple man. I just want to read the data, massage the data to convert it to the new...
  4. dipique

    Using custom attributes to contain a target field/property for a search

    Big Picture I maintain a large web application with the primary function of managing orders. It is an MVC over C# application using EF6 for data. There are LOTS of search screens. Right now every search is coded without any code re-use (before my time, I swear!). What I'm Trying To Do I'm...
  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=...
  6. F

    Question Copying an object changes its reference

    I'm using an "object factory/pool" to store sprites. I have it set up so that: ASprite tmp = spritePool.GetObject(); tmp.state = 133; Will make a new object for tmp, then set its state to 133. All the objects in the pool are stored in an array. Now, I want to populate that pool by...
Back
Top Bottom