NGon Extension method, properly organize C#


I wrote some NGons extension methods. I have quite a lot of them. And I would like to organize my code better.

For now one of extension methods looks like this:
public static int[][] GetNgonsConnectedToNGonsEdges(this Mesh mesh, HashSet<int> allNGonsEdges, bool flag = true){...}

It means each time I use meshes I can type

Since it is all about ngons, I would like not type to

How can I properly do this? Is it possible?
Because in extension methods I still use mesh functions, but it is all about ngons.

I don’t think it is possible to do that kind of namespacing. You’d best make sure your extension method naming scheme is clear enough. Instead of looking for a NGon namespace you could just always start your extension methods for them with Ngon, i.e. NgonGetNgonsConnectedToNgonsEdges. It will be quite a bit to type, but with a good editor that has proper autocompletion that shouldn’t be a problem.

edit: See “General Guidelines”. In your case it is probably best to create your own class inheriting from Mesh, so that you can add the NGons property to provide the extension interface you seek.

Thanks for the reply.

Probably the best option is to unify names by starting extension methods by mesh.NGons…

And then I will probably shorted extension method name and add explanation in xml.

Documentation and communication are indeed key here :slight_smile: