473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Static Crossover


I wrote two windows services that are slight variations on each other.

I changed the assembly name ( .exe ) and the namespace within each other.

Both have some static methods that share the same name.
I am seeing some evidence that there may be memory crossover -- where
one assembly is accesing resources defined in a same named method of the
other.
Is that possible? Are static members shared across namespaces?

Nov 17 '05 #1
2 1505
John,

Short form, no, it is not possible.

When you have a static member in two different namespaces, that means
that they are each attached to two different types. Even if the types are
the same name, code, etc, etc, if the namespaces are different, then they
are two different types. The static fields for one are not going to be the
same as the static fields for another.

Additionally, the CLR makes sure that the scope of static fields is the
app domain you are running in, of which there can be multiple ones in a
process. That leads us to the fact that static field values are not shared
among the same type in separate processes.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John A. Bailo" <ja*****@texeme.com> wrote in message
news:8u********************@speakeasy.net...

I wrote two windows services that are slight variations on each other.

I changed the assembly name ( .exe ) and the namespace within each other.

Both have some static methods that share the same name.
I am seeing some evidence that there may be memory crossover -- where one
assembly is accesing resources defined in a same named method of the
other.
Is that possible? Are static members shared across namespaces?

Nov 17 '05 #2

Thanks!

False alarm anyway, I was referencing the same filename for logging in
two of the supporting classes so it looked like crossover, but it wasn't.
Nicholas Paldino [.NET/C# MVP] wrote:
John,

Short form, no, it is not possible.

When you have a static member in two different namespaces, that means
that they are each attached to two different types. Even if the types are
the same name, code, etc, etc, if the namespaces are different, then they
are two different types. The static fields for one are not going to be the
same as the static fields for another.

Additionally, the CLR makes sure that the scope of static fields is the
app domain you are running in, of which there can be multiple ones in a
process. That leads us to the fact that static field values are not shared
among the same type in separate processes.

Hope this helps.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
15
by: Samee Zahur | last post by:
Question: How do friend functions and static member functions differ in terms of functionality? I mean, neither necessarily needs an object of the class to be created before they are called and...
2
by: John A. Bailo | last post by:
I wrote two windows services that are slight variations on each other. I changed the assembly name ( .exe ) and the namespace within each other. Both have some static methods that share the...
5
by: Mountain Bikn' Guy | last post by:
How would I do this? public sealed class UtilityClass { public static MyObject Object1;//see note below about importance of static object names in this class public static MyObject Object2;...
3
by: Mauzi | last post by:
hi, this may sound odd and noob like, but what is the 'big' difference between static and non-static funcitons ? is there any performace differnce? what is the best way to use them ? thnx ...
3
by: Jay | last post by:
Why are there static methods in C#. In C++ static was applied to data only (I believe) and it meant that the static piece of data was not a part of the object but only a part of the class (one...
55
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in...
14
by: Jess | last post by:
Hello, I learned that there are five kinds of static objects, namely 1. global objects 2. object defined in namespace scope 3. object declared static instead classes 4. objects declared...
2
by: jrmemon007 | last post by:
I have 2 computers, one is a acer laptop and the other is a desktop. i want to connect the computers without a router, and only using the crossover cable. After some hardwork the laptop establishes a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.