2
Would it be possible to declare a property in codeunit as it already exists in other languages such as C#.
We would use the Get and Set Assessors and Mutators to assign the protected variables of the codeunit

What would be the benefits?

1- More convenient use of the sender when using events.
2- Put the use of codeunit back in the execution of business processes back at the center.
3- Enter deeper into object development which will increase BC's overall performance. The table would become just a way to store the data (Data Access Logic) and the codeunit an object in its own right that would be the pivot between the data and the graphical representation.
4- The rest then becomes logical, we can extend the codeunit and restructure our codes towards an object model... and for Microsoft to sell more Codeunit Object pack.
5- Attract talented young developers to AL development which is similar to an old development tool. You have to send a little dream.

Exemple implementation:

protected _myVar : text;
protected _mVarModified : dateTime;

public MyVar: Text
{
get{
Exit(_myVar);
}
set{
_myVar := Value;
_mVarModified := CurrentDateTime;
}
}

procedure Save()
var
LogMyVar : Record "Log My Var"
{
LogMyVar."My Var" := _myVar;
LogMyVar."Modified At" := _mVarModified;
LogMyVar.Insert(True);
}
Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team