|I have a class called Cls_Common.cs which contains a structure called St_Common where I declare the global variables that are common to all .cs files. I use it in Functions, compiled classes .dlls and in Mains.
I create a compiled .dll class to encrypt using these functions and the global structure of Cls_Common.cs.
When i add by reference the compiled class .dll to a Main, in the compile it generates in Visual Studio, there are actually two versions of the file Cls_Common.cs. When doing =new of the global structure, an ambiguity error occurs but execution continues and when an attempt to assign or retrieve a global structure value, occurs an error exception.
In order to compile the Cls_Encrypt.dll class I need to include Cls_Common.cs to use common functions. At Main that includes by reference Cls_Encrypt.dll I also need to include Cls_Common.cs and that produces ambiguity.
According to Microsoft's brief solution to error CS0433, you have to compile from the command line with /reference and use an alias:
// compile with: /reference:cs0433_1.dll /reference:TypeBindConflicts=cs0433_2.dll
public class Test
public static void Main()
AggPubImpAggPubImp n6 = new AggPubImpAggPubImp();
public struct St_Common
public string Languaje;
public static partial class Cls_Common
public static Name_Common.St_Common StCommon;
}Class compiled in an assembly called Cls_Encrypt.dll This class uses in Mains adding it as reference. Used to encrypt. Inside the class, calls are made to functions such as Func1.cs, Func2.cs ... That use the global variable structure Name_Common.Cls_Common.StCommon
public class Cls_Encrypt
if (Name_Common.Cls_Common.StCommon.Languaje == "Eng") ...
}Main where I added as reference to compiled class Cls_Encrypt.dll
Name_Common.Cls_Common.StCommon = new Name_Common.St_Common();
string MyVar = Name_Common.Cls_Common.StCommon.Languaje;
}The solution of Microsoft does not serve me because I have to leave Visual Studio to compile from the command line every time I make a change and the solution serves in the main but the functions do not refer to the alias. The solution seems like a fix.
It does not help me to pass by reference the global structure from the main to .dll because to compile the .dll I need to reference the type of the global structure of Cls_Common.cs. In addition, I would need to go through many structures because the .cs functions
are many and require new and different variables. Need global structures, not references.
I ask this:
1.- How can I use a single copy of a global structure in a compiled class .dll and in a main.
2.- When I use the Visual Studio debugger, if the form is large I can not see the code below. How to hide the form?
3.- I have read that I can stop the execution in the debugger (F9) and that I can press Interrupt, Modify a line and Continue. But he will not let me interrupt. How is made? Because now I have to stop the execution and start again.
I do not understand how this problem occurred when it is logical to use a global structure in Main, Functions and .dlls
modified 4-Jan-17 12:56pm.