What's the purpose of using nullables on classes? #163
Replies: 6 comments
-
Hello, By doing Of course, this only shows when you're also using Nullable. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response, but I still don't see the reasoning, I removed the nullable context everywhere (as it conflicts with my project) and it all still works, you can pass null and it works just fine. Again, PortModel is already nullable, the ? is redundant. the nullable operator is just meant for non-reference types like structs, int, double, etc. |
Beta Was this translation helpful? Give feedback.
-
Not sure what you're talking about, removing |
Beta Was this translation helpful? Give feedback.
-
Like I said, I removed the nullable context, so, no, I don't get any warnings. And thanks for the link, I haven't seen that, but after reading it, It still seems almost useless to me, I mean I guess there are trade offs, but integrating with projects that don't have the nullable context enabled seems like a big drawback (as I don't see many projects that use this, in fact this is the only one). In any case, thanks for the great work! I abandoned other third party paid solutions, because this worked better 👍 |
Beta Was this translation helpful? Give feedback.
-
Well, it could be useless to you but not to everyone. But as you said, if you're not working in a Nullable context yourself, then it is close to useless, but otherwise, it's very helpful to know what could be null and what will never be. Enjoy! If possible, I'd love to have a chat with you to know what these third-party solutions are and why you switched? After all, the purpose of this library is to only get better, and your opinion would definitely help! |
Beta Was this translation helpful? Give feedback.
-
Sure, I sent you an email (didn't see this moved to a discussion), so I'll post it here as well I was trying gojs and jointjs/rapid. They were both okay but the setup was more painful. I preferred jointjs to gojs, but the main drawback was the missing zoom/scaling. I did get it to work eventually with an additional lib (SVG Pan and Zoom, I think). Ultimately I prefer C# and this lib did almost everything I needed out of the box, and I was able to get the look I wanted faster. For example, I like the DiagramOptions to set up things how I can easily extend what I need. The only thing this lib was missing for me was the ability to reassign links by dragging them. I think someone else has suggested this as an enhancement. It's something I can tackle on my own, but I do think it'd be a great feature to have. |
Beta Was this translation helpful? Give feedback.
-
Hi, maybe I'm missing something here, but what's the purpose of these? for example "PortModel?" here:
public event Action<BaseLinkModel, PortModel?, PortModel?>? TargetPortChanged;
I mean, PortModel is already a class (reference type), so it's already nullable, right?
Beta Was this translation helpful? Give feedback.
All reactions