Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
 In WPF with C# i use a partial structure that happened as a parameter in many functions. A part of the structure is in the Comun.cs file that is compiled in Comun.dll and contains general variables to all the programs.

The other part of the partial structure is in a Local.cs file and contains variables specific to each program. I have put this file in App_Data.


When compiling with VS, in the places where i refer to the Local.cs variables, the program tells me that the variables are not recognized. I need to be able to compile the final program so that it recognizes all the variables.I have read that there is a partial interface but I do not know if it is useful for this.

Comun.cs -> Comun.dll

public partial struct St_Gen

{   public int Languaje;

}

 

Local.cs

public partial struct St_Gen

{   public int LocalVariable;

}

2.- Another problem is that I can not find the documentation on the structure of the WPF directories. Ex: App_Data what is it for ...

3.- another problem is that it is difficult to find code from other developers in WPF. ¿why? ¿Do you know any site besides codeproject?

4.- Why are there no examples of current WPF codes? Almost all are old.

5.- Working in C # What is more advanced than WPF?

Thanks


What I have tried:

What have you tried?
What have you tried?
Posted
Updated 18-Aug-18 4:48am
v2

The partial keyword allows you to spread content across multiple files, but ... only within the same namespace, and only at compile time - you cannot use partial to "extend" a struct from outside the assembly it is defined in.

It is not possible to "add" variables to a struct in the way you want. (And you can't inherit from a struct at all, so you can't derive a new struct or class from them either.)

Think about what you are trying to do: there is probably a much, much better way to do it!
 
Share this answer
 
v2
Comments
[no name] 18-Aug-18 10:40am    
Is it not possible in some way using partial interface?

Can someone answer the other questions I ask? Is WPF a good system or should I move on to something better (with c#)? Thank you
Is it not possible in some way using partial interface?

Why it is not allowed to pass as a parameter ref dynamic?

Can someone answer the other questions I ask? Is WPF a good system or should I move on to something better (with c#)? Thank you
 
Share this answer
 
Comments
Richard MacCutchan 18-Aug-18 11:18am    
OriginalGriff has already explained that you cannot do what you are asking for.
And WPF is built on C# so what do you mean by "better"?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900