GithubHelp home page GithubHelp logo

nyrest / fastgenericnew Goto Github PK

View Code? Open in Web Editor NEW
218.0 218.0 6.0 2.11 MB

The ultimate fast alternative to Activator.CreateInstance<T> / new T()

License: MIT License

C# 98.91% PowerShell 1.09%
activator createinstance csharp csharp-library csharp-sourcegenerator delegate dotnet dotnet-core expression fast generic incremental library netframework nuget optimization performance roslyn roslyn-analyzer sourcegenerator

fastgenericnew's Introduction

Hi there 👋

Statistics

Trophies

fastgenericnew's People

Contributors

dependabot[bot] avatar imgbotapp avatar nyrest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fastgenericnew's Issues

XML Comments

  • FastNew
  • FastNew.CreateInstance
  • FastNew.TryCreateInstance
  • FastNew.Constructor

Fix annoying CS1591 warning

Help for implementation in a different setup.

Hi,
I have a specific setup where I'm using Activator.CreateInstance.
Because I have a memory leak I want to try your approach.

But I'm not an expert so I want to ask you help to understand how to do it.

Here my current code
I have an array of class name like this one:

 public static readonly string[] authTables = new string[]
        {
            typeof(User).FullName,
            typeof(UserInfo).FullName
        };

and I give it to my method (in tables):

   public static void CreateTablesInDB(SqliteConnection con, string[] tables)
        {
            foreach (var table in tables)
            {
                Type tableType = Type.GetType(table + ", MyAssemblyName");//* assembly name                
                var instanceTable = Activator.CreateInstance(tableType);
                // here do some stuff with my instanceTable....
                string strCreateTable = ClassToDDL(instanceTable, "create");
            }
        }

User and UserInfo are my classes.

My question is: Can I use your approach? In which way?

Thank you.

[WIP] Wiki

īŧ˛īŧŠīŧ° me

  • Introduction

    • Welcome
    • Why FastGenericNew
    • When to use FastGenericNew
    • How this works
  • Get started

    • Installation Instructions
      • .NET CLI
      • PackageReference
      • Package Manager
      • Script & Interactive
  • API Summary & Examples

    • FastNew.CreateInstance
    • FastNew.TryCreateInstance
    • FastNew.GetCreateInstance (Unstable currently)
    • FastNew.GetTryCreateInstance (Not finished)
  • SourceGenerator

    • Description
    • When to use SourceGenerator
    • Compiler Options (A lot of work is needed, too many options 😨)
  • Notes

    • TBD

I'll start working after the stable version is released

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.