-
Couldn't load subscription status.
- Fork 4.2k
Closed
Labels
Area-Language DesignDiscussionFeature RequestLanguage-C#Resolution-Not ApplicableThe issue is not relevant to code in this repo and is not an external issue.The issue is not relevant to code in this repo and is not an external issue.
Milestone
Description
Premise
Allow lambda function (in particularly LINQ) to rewritten by the compiler as inline version of the algorithm. No Closures, No Delegates
Syntax
This would be enable by prefixing the lambda with inline eg
inline (x,y)=> ;
Example
The foreach aspect of the pull request #209 could written via Aggregate.
int hash = Hash.Combine(_location.GetHashCode(),
Hash.Combine(_severity.GetHashCode(), _warningLevel));
hash = _messageArgs.Aggregate( hash, inline (_h, item)=> HashCode.Combine( _h, item) );
hash = HashCode.Combine( _descriptor, hash)
return hash;would be rewritten as an inline implementation.
int hash = Hash.Combine(_location.GetHashCode(),
Hash.Combine(_severity.GetHashCode(), _warningLevel));
/* Begin Inline (Aggregate) */
var _h = hash;
foreach(var item in _messageArgs)
{
HashCode.Combine( _h, item);
}
hash = _h
/* End Inline ( Aggregate ) */
hash = HashCode.Combine( _descriptor, hash)
return hash;
Admittedly the produce code is slightly less efficient (an extra variable).
Metadata
Metadata
Assignees
Labels
Area-Language DesignDiscussionFeature RequestLanguage-C#Resolution-Not ApplicableThe issue is not relevant to code in this repo and is not an external issue.The issue is not relevant to code in this repo and is not an external issue.