Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
139 views
in Technique[技术] by (71.8m points)

c# - Self referencing a class


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Given what you intend to use it for it is fine. Think of it like a linked list, but instead of only one possible next you have multiple options (if I understood it's usage correctly). Is it the most appropriate choice? That would require more information about your requirements. Also that probably would become opinion-based.

I would update the naming convention so it's clear what each field does. If it's doing too many things you might want to try splitting it into more than one field, if possible. Generally you shouldn't have to rely on comments to explain what is intended by each field as the name should make it clear. That doesn't mean you should never use comments, just use it sparingly and wisely.

For example, if your choices is the next set of choices if this particular choice is selected then you might want to prepend it with next.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...