Using the query expression style, the let clause can be easily written. My question is how to use the dot notation style to write a let clause.
What is the Dot Notation? In simple words, the dot (.) notation is a way to access the attribute and methods of each method of instances of different object classes. It is usually preceded by the object instance while the right end of the dot notation contains the attributes and methods.
Dot Syntax Is a Concise Alternative to Accessor Method Calls As well as making explicit accessor method calls, Objective-C offers an alternative dot syntax to access an object's properties. Dot syntax allows you to access properties like this: NSString *firstName = somePerson. firstName; somePerson.
Essentially it's a Select
(in most cases) which introduces a transparent identifier - via an anonymous type which encapsulates all the currently specified range variables. For example, this query:
string[] names = { "Jon", "Mark" };
var query = from name in names
let length = name.Length
where length > 3
select name + ": " + length;
is translated into something like this:
var query = names.Select(name => new { name, length = name.Length })
.Where(z => z.length > 3)
.Select(z => z.name + ": " z.length);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With