Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1048275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:25:49+00:00 2026-05-16T16:25:49+00:00

Suppose I have a .NET dll with class ‘B’ and function ‘C’. I then

  • 0

Suppose I have a .NET dll with class ‘B’ and function ‘C’.

I then have a multithreaded .NET program that references the dll.

Each thread instances the class ‘B’ and calls the function ‘C’. Upon instantiation the class ‘B’ allocates all of its own variables on the heap. These variables are used by the function ‘C’.

Does this create a distinct instance of the class (i.e. is it safe to call function ‘C’ in each of the threads of the main program) or would I have to somehow dynamically load the DLL.

(In other words, does the .NET DLL behave like the Win32 LoadLibrary function (reference counting), where you have to give one dll different names and then load those, to create distinct instances.)

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:25:50+00:00Added an answer on May 16, 2026 at 4:25 pm

    In .Net, type resolution is based on the assembly name, not the binary name. Thus, even if you manage to get two copies of your dll in the process memory, the type definition of the class B will be the same, and will use the same static variables instances.

    However, each of your threads could load the assembly in a separate appdomain, in which case each appdomain gets its own instance of the static variables. The drawback would be that your code will cross an appdomain boundary each time it calls into the method C.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have an ADO.NET DataTable that I was to 'persist' by saving it
Suppose I have an action that returns an rendered asp.net mvc control and send
Suppose I have an MSI, that has .NET Framework as a pre-requisite. I know
Suppose I have a static method of my class that returns an object of
I have a .NET application that uses an assembly (.dll) that defines some method:
Lets suppose I have an .NET client application that connects to a WCF service,
Suppose you have two seperate ASP.NET Web Application projects that both need to use
Suppose I have the following asp.net page: public partial class SamplePage : System.Web.UI.Page {
I currently have a C function that I'd like to use in .NET (C#).
Suppose I have two .NET DataTables populated as follows, where ID is the primary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.