Page 1 of 1

Possible solution for code behind in c#9?

Posted: 25 May 2021, 13:17
by KeldorKatarn
Could this be a solution for you guys? This should allow you to get those code behind things added.

https://devblogs.microsoft.com/dotnet/i ... enerators/

Re: Possible solution for code behind in c#9?

Posted: 25 May 2021, 13:36
by KeldorKatarn
Also just saw another thing incoming in C#10

https://kenbonny.net/introducing-csharp-10
It will now be possible to create a single file with namespace imports that are used everywhere. For example, if there is a popular namespace that is used in virtually every file, say Microsoft.Extensions.Logging.ILogger, then it will be possible to add a global using Microsoft.Extensions.Logging.ILogger to any .cs file (I suggest the Program.cs or a dedicated Imports.cs) and the logger interface will be available in the entire project. Not the solution! Nobody can predict which imports are needed anywhere, so they are grouped per project.
That should solve the pesky #if UNITY_blahblah#endif for using directions. Only one such Imports.cs file in the project, having one such #if and the rest of the project is fine.
I'm sure gonna love that for Caliburn :P

Re: Possible solution for code behind in c#9?

Posted: 27 May 2021, 14:38
by jsantos
Could this be a solution for you guys? This should allow you to get those code behind things added.
https://devblogs.microsoft.com/dotnet/i ... enerators/
Yeah, that could be perfect for Noesis. It would help us to properly implement #1790.

Thanks for sharing. Let's see when we have time for this (apart from the problem that this needs c#9)