The DllImport attribute is useful when reusing existing unmanaged code in a managed application. For instance, your managed application might need to make calls to the unmanaged WIN32 API. Which internally using PInvoke Service to call Unmanaged
If you want to reuse, Managed code i.e code written in .NET framework, you can add reference and start using those classes.
Hope this will answer your question. Feel free to contact in case of query.
If this post answers your question, please click Mark As Answer. If this post is helpful please click
Mark as Helpful.