Sometimes I see in source code long chain of checks by Assigned() in deep of object like
if Assigned (ASomeObj)
and Assigned (ASomeObj.Session)
and Assigned (ASomeObj.Session.UserInfo)
and Assigned (ASomeObj.Session.UserInfo.SomeFactsList)
then
// to do some actions
It's the way to check by nil all intermediate entities. Maybe anybody knows a way to cropping chain in condition part?
As an idea a watched to
try
if Assigned (ASomeObj.Session.UserInfo.SomeFactsList)
then
// to do some actions
except
end;
Whether exists paths to simplify it? How it is clear and easy for reading source code?
As I know in Csharp exist "?" operator for using like ASomeObj?.Session?.UserInfo?.SomeFactsList for check by Null
