Writing Platform-specific C# code using Partial class definitions not working with Uno Platform 4.8 #12092
Unanswered
williamrousseau
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The C# Partial classes feature only works in the same project. The documentation about it is dealing with shared projects, a structure that is not used anymore by the new project templates. Are you trying to create a Wasm-specific class? If so, you may need to use inheritance. This will change in .NET 8 when the new |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to write Platform-specific C# code using Partial class definitions in a simple project using Uno Platform 4.8 and .NET 7.0 following the example showed in Platform-specific C# code in Uno documentation, but there is an issue when adding the partial class tothe specific platform.
When calling the function created in the platform specific partial class from the partial class contained in shared, a building error occurs because the function does not exists.
How can we reference the Platform specific project to the shared project to access the other partial class part from the platform specific project?
Here's my example:
Partial class in
SampleProject/MyPartialClass.cs
Partial class in
SampleProject.Windows/MyPartialClass.cs
Partial class in
SampleProject.WASM/MyPartialClass.cs
Here's how the project is structured:
Here's the error from Partial class in
SampleProject/MyPartialClass.cs
:My example is exactly the same as the example here, but it does not compile.
How to make it compile? Is it a problem known with Uno Platform 4.8 and .NET 7.0?
Beta Was this translation helpful? Give feedback.
All reactions