3,678 questions
2
votes
1
answer
67
views
How to assign different values to a parameter of vector of record
I have a record with default parameter values for a system. I'm building a vector of system, so I build a vector of the record. I want to be able to edit this vector of record using the Dymola ...
5
votes
1
answer
273
views
How can I prevent CS7036 error when initializing a record object?
I have created the following book dto:
public record BookDto(string? Id, string Name, string Genre, string Author);
Using linq, I select a book from my database and want to create a dto from it, like ...
4
votes
1
answer
200
views
.NET 10 behavior change - Configuration binding an IEnumerable record has missing entries when nullable parameters are null
We have a web application with configuration supplied by an appsettings.json file. The configuration includes a collection of a custom type with nullable values. Prior to upgrading to .NET 10, the ...
Advice
1
vote
7
replies
131
views
When is a record not a value type?
Introduction
Jep 401 will introduce "value classes" to the Java programming language. As such, they have no identity, as their inherent state completely describes what they are. The non-...
3
votes
1
answer
120
views
Record's read-only Property not getting recalculated when using `with`?
I have encountered this strange behavior:
var a = new Foo([new(1), new(2), new(3)]);
Console.WriteLine(a.Sum); // Print 6
var b = a with
{
Items = [
a.Items[0] with { Value = 10},
...
Best practices
1
vote
5
replies
178
views
In Java, should I use `@Override` for record fields?
If my record implements an interface, with a field accessor implicitly implementing a method, it should be an instance of what the @Override annotation is meant to cover.
interface I { int f(); }
...
Advice
0
votes
2
replies
70
views
Is it possible to use Static_Predicate with a record type?
I wanted to define a record type with a Static_Predicate:
-- irregular_matrices.ads
generic
type Element_Type is private;
package Irregular_Matrices is
subtype Index_Type is Positive;
...
7
votes
1
answer
157
views
Records don't deserialize cycles
I stumbled upon something that got me curious. Apparently, serializing a record with a cyclic reference does not retain the cycle when deserializing it again, it becomes null. When doing the same ...
0
votes
1
answer
83
views
What is "freezing" and how to declare a vector of variant record type?
I've written the next piece of code in order to declare a vector of lexical elements:
type Lexical_Element_Kind
is (
Delimiter, -- & ' ( ) * + , - . / : ; < = > |
-- => .. ...
0
votes
1
answer
95
views
User Friendly Duplicate value message [duplicate]
I want to check to see if value from a form exists in Microsoft Access table using vba or macro that is user friendly but need help putting it together.
I've tried, Private Sub Donor_Key_LostFocus() I ...
1
vote
1
answer
104
views
How do I specify the correct record dependency version for my Flutter app in VSCode?
I want the app to record the user's voice and send it to a CSV file (Google Sheets). I have it working for user input so far. In my "pubspec.yaml" file, I've defined the record, ...
2
votes
1
answer
76
views
GHC.Record : Record data type may not be a data family
I would like to create a virtual record field "r" for the red component of a color using the Color package. This package uses a data family Color.
I tried to write the following :
import GHC....
2
votes
1
answer
159
views
Why is a field not initialized when using a custom record copy constructor?
I have this record:
record Foo {
string _bar = "initialized";
public string Bar => _bar;
}
I'm running the following code:
var foo = new Foo();
Console.WriteLine(foo?.Bar ?? &...
1
vote
1
answer
37
views
Null checks for record constructor arguments in Groovy
We are in the Groovy universe. Let's say I have a record like follows:
record Person(String firstName, String lastName, String city) {}
What is the shortest way to make sure that none of the three ...
2
votes
3
answers
203
views
Automatic property dependent on other properties
Let's say I have this:
class AA(string a, string b, string? c) {
...
}
record BB {
public string A { get; init; };
public string B { get; init; };
public string? C { get; init; };
...