Custom record constructors are highlighted as struct
See original GitHub issueVersion Used: VS 16.7.2
Steps to Reproduce:
Code like below:
public sealed record Record(int A, int B, int C, int D)
{
public Record() : this(default, default, default, default)
{
}
}
Expected Behavior:
The constructor name Record
will be highlighted in green (class
es).
Actual Behavior:
The constructor is highlighted in pink (struct
s). In my machine, class
es will be highlighted in green, while the struct
s are pink.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (12 by maintainers)
Top Results From Across the Web
C# — Class, Struct, Record, Record Struct | by GM Fuster
Class: a construct that enables you to create your own custom types by grouping together variables of other types, methods and events. Struct:...
Read more >C# - Calling a struct constructor that has all defaulted ...
This is pretty evident, since C# will not let you define a parameterless constructor for a struct , though it is curious that...
Read more >Record structs - C# 10.0 draft feature specifications
Instance field declarations for a record struct are permitted to include variable initializers. If there is no primary constructor, the instance ...
Read more >C# 10 - `record struct` Deep Dive & Performance Implications
In this blog post I will do a deep dive into record struct being ... Constructor matching the properties; Custom overridden ToString() ...
Read more >Should structs Have Constructors in C++
Custom initialization without a constructor ... To break this dependency we can tear out the constructor from the struct and replace it with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We probably want a new classification for this entirely. A record is a record. If people want records to have a different color, we should likely support that 😃 Note, the default here can be for it to colored like a class (same as we do for interfaces/delegates/etc.).
Oh i see. You’re asking that the decl be classified in a certain fashion, not that references be classified. That’s a very interesting case. Would you be willing to open an issue asking for this? I can take it to a design meeting to see how the team feels on this.
Thanks!