Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Automatic tuple name bindings #591

Closed
bradphelan opened this issue May 17, 2017 · 2 comments
Closed

[Feature] Automatic tuple name bindings #591

bradphelan opened this issue May 17, 2017 · 2 comments

Comments

@bradphelan
Copy link

I just realized that this

        foreach (var o in from toolPathItem in controlPointSolvedInterpolator.GroupedKeyPoints.Concat()
                          from edgePosition in toolPathItem.ToolAxesSolved.RailPositionOption.AsEnumerable()
                          from edgeCurve in toolPathItem.ControlPoint.Run.EdgeCurveOption.AsEnumerable()
                          select (toolPathItem, edgePosition, edgeCurve))
            color = RenderPointOnEdge( renderMesh, o.toolPathItem, color, o.edgeCurve, o.edgePosition, d );

doesn't work but

        foreach (var o in from toolPathItem in controlPointSolvedInterpolator.GroupedKeyPoints.Concat()
                          from edgePosition in toolPathItem.ToolAxesSolved.RailPositionOption.AsEnumerable()
                          from edgeCurve in toolPathItem.ControlPoint.Run.EdgeCurveOption.AsEnumerable()
                          select new {toolPathItem, edgePosition, edgeCurve})
            color = RenderPointOnEdge( renderMesh, o.toolPathItem, color, o.edgeCurve, o.edgePosition, d );

does. I would have to do

        foreach (var o in from toolPathItem in controlPointSolvedInterpolator.GroupedKeyPoints.Concat()
                          from edgePosition in toolPathItem.ToolAxesSolved.RailPositionOption.AsEnumerable()
                          from edgeCurve in toolPathItem.ControlPoint.Run.EdgeCurveOption.AsEnumerable()
                          select (toolPathItem : toolPathItem, edgePosition:edgePosition, edgeCurve:edgeCurve))
            color = RenderPointOnEdge( renderMesh, o.toolPathItem, color, o.edgeCurve, o.edgePosition, d );

to get the tuple version working. This is a bit unfortunate as the ValueTuple version is more efficient but the code is much uglier. Can we please have automatic tuple name generation just like with anonymous types?

@bradphelan
Copy link
Author

@jnm2
Copy link
Contributor

jnm2 commented May 17, 2017

Yes. Conversation here: #370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants