KeldorKatarn
Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

Possible solution for code behind in c#9?

25 May 2021, 13:17

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/
 
KeldorKatarn
Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

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

25 May 2021, 13:36

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
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

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

27 May 2021, 14:38

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)

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 97 guests