Allow semicolon termination of nested classes in code file or dot notation for class hierarchies #8954
-
When creating nested classes it would be nice to apply semicolon termination of parent classes in a code file just as can be done with namespaces. Currently:
REMOVED INVALID SUGGESTION FOR SEMICOLON TERMINATION OF CLASSES AS SYNTAX IS APPLIED TO CLASSES WITH NO MEMBERS Dot notation for class hierarchies:
Some would argue that namespaces are sufficient though namespaces do not support members directly. Properties in the App or List classes would be defined in their own code file and that is why no properties appear for those classes in the above code file. For clarity, the usage for the above shown in main somewhere in the program
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
@Dragan-Radovac-75 #711. And iirc there are few more issues about it. |
Beta Was this translation helpful? Give feedback.
-
namespace Application;
public partial class App;
public partial class List;
public partial class Column
{
public static int Height { get; set => field = value; }
public static int Width { get; set => field = value; }
} This is already valid syntax, so it can't be changed. It will declare three classes: |
Beta Was this translation helpful? Give feedback.
-
@colejohnson66 Yes, the syntax is valid but App is not a parent of List and App and List are not parents of Column. Therefore the syntax shown in the Main method is not valid.
Also, your right. My suggestion in that regard could not coexist with the current implementation of classes terminated with a semicolon. Thankyou for providing clarity and the thumbs down is a great confidence boost which compelled me to remove the incorrect syntax. |
Beta Was this translation helpful? Give feedback.
-
@iam3yal I was unaware of your proposal which is exactly what I want. Is there a way for me to link my suggestion to your proposal and close off this suggestion ? |
Beta Was this translation helpful? Give feedback.
This is already valid syntax, so it can't be changed. It will declare three classes:
App
,List
, andColumn
.