Is there any way, how to change it:
Nameslope library {public structure content {Int a; Int b; }}
I have the structure in library 2. Content that has defined the data in the same way ( {int a; int b;}
), but different methods.
Is there a way to change a structure instance from the library? Content from Library2.Content? Something like this:
Library. Content C1 = New Library Content (10, 11); Library 2. Content C2 = (Libre 2. Content) (C1); // It does not work
You have several options, including the following :
- You can define a clear (or implicit) conversion operator from one type to another, note that it means that a library (defining the conversion operator) depends on the other Must have to take.
- You can define your own utility method (possibly an extension method) that is different from one type to another. In this case, to convert, your code will need to be changed, which the artists will need to implement the utility method instead of doing.
- You can simply pass a
Library2.Content
and for the Creator ofLibrary.Content
.
Comments
Post a Comment