Minimize these LINQ codes [on hold]
up vote
-2
down vote
favorite
I am using LINQ to get a list of variables in a list of objects, but it seems long. Is there a way to minimize these? How do I refactor this line of codes?
var _text = draw.Layers.Select(x => x._Text).ToList();
var family = draw.Layers.Select(x => x.Family).ToList();
var fontSize = draw.Layers.Select(x => x.Size).ToList();
var style = draw.Layers.Select(x => x.Style).ToList();
var fillType = draw.Layers.Select(x => x.fillType).ToList();
var both = draw.Layers.Select(x => x.textBoth).ToList();
var width = draw.Layers.Select(x => x.textW).ToList();
var height = draw.Layers.Select(x => x.textH).ToList();
var centered = draw.Layers.Select(x => x.AlwaysCentered).ToList();
var rAngle = draw.Layers.Select(x => x.angle).ToList();
var origin = draw.Layers.Select(x => x.origin).ToList();
var offset = draw.Layers.Select(x => x.offset).ToList();
var mirror = draw.Layers.Select(x => x.mirrored).ToList();
var align = draw.Layers.Select(x => x.AlignToArc).ToList();
var flipY = draw.Layers.Select(x => x.FlipY).ToList();
var RTL = draw.Layers.Select(x => x.RightToLeft).ToList();
var tRadius = draw.Layers.Select(x => x.arcRadius).ToList();
var tAngle = draw.Layers.Select(x => x.arcAngle).ToList();
var spacing = draw.Layers.Select(x => x.arcSpaces).ToList();
var txtLocation = draw.Layers.Select(x => x.locationText).ToList();
var moveX = draw.Layers.Select(x => x.moveX).ToList();
var moveY = draw.Layers.Select(x => x.moveY).ToList();
c# linq
New contributor
put on hold as unclear what you're asking by Heslacher, t3chb0t, Toby Speight, VisualMelon, Denis 18 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-2
down vote
favorite
I am using LINQ to get a list of variables in a list of objects, but it seems long. Is there a way to minimize these? How do I refactor this line of codes?
var _text = draw.Layers.Select(x => x._Text).ToList();
var family = draw.Layers.Select(x => x.Family).ToList();
var fontSize = draw.Layers.Select(x => x.Size).ToList();
var style = draw.Layers.Select(x => x.Style).ToList();
var fillType = draw.Layers.Select(x => x.fillType).ToList();
var both = draw.Layers.Select(x => x.textBoth).ToList();
var width = draw.Layers.Select(x => x.textW).ToList();
var height = draw.Layers.Select(x => x.textH).ToList();
var centered = draw.Layers.Select(x => x.AlwaysCentered).ToList();
var rAngle = draw.Layers.Select(x => x.angle).ToList();
var origin = draw.Layers.Select(x => x.origin).ToList();
var offset = draw.Layers.Select(x => x.offset).ToList();
var mirror = draw.Layers.Select(x => x.mirrored).ToList();
var align = draw.Layers.Select(x => x.AlignToArc).ToList();
var flipY = draw.Layers.Select(x => x.FlipY).ToList();
var RTL = draw.Layers.Select(x => x.RightToLeft).ToList();
var tRadius = draw.Layers.Select(x => x.arcRadius).ToList();
var tAngle = draw.Layers.Select(x => x.arcAngle).ToList();
var spacing = draw.Layers.Select(x => x.arcSpaces).ToList();
var txtLocation = draw.Layers.Select(x => x.locationText).ToList();
var moveX = draw.Layers.Select(x => x.moveX).ToList();
var moveY = draw.Layers.Select(x => x.moveY).ToList();
c# linq
New contributor
put on hold as unclear what you're asking by Heslacher, t3chb0t, Toby Speight, VisualMelon, Denis 18 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
3
Is there any reason why you can't simply usedraw.layers
instead of getting every property of it?
– Bruno Costa
21 hours ago
2
The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review - Asking Questions for guidance on writing good question titles.
– BCdotWEB
21 hours ago
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I am using LINQ to get a list of variables in a list of objects, but it seems long. Is there a way to minimize these? How do I refactor this line of codes?
var _text = draw.Layers.Select(x => x._Text).ToList();
var family = draw.Layers.Select(x => x.Family).ToList();
var fontSize = draw.Layers.Select(x => x.Size).ToList();
var style = draw.Layers.Select(x => x.Style).ToList();
var fillType = draw.Layers.Select(x => x.fillType).ToList();
var both = draw.Layers.Select(x => x.textBoth).ToList();
var width = draw.Layers.Select(x => x.textW).ToList();
var height = draw.Layers.Select(x => x.textH).ToList();
var centered = draw.Layers.Select(x => x.AlwaysCentered).ToList();
var rAngle = draw.Layers.Select(x => x.angle).ToList();
var origin = draw.Layers.Select(x => x.origin).ToList();
var offset = draw.Layers.Select(x => x.offset).ToList();
var mirror = draw.Layers.Select(x => x.mirrored).ToList();
var align = draw.Layers.Select(x => x.AlignToArc).ToList();
var flipY = draw.Layers.Select(x => x.FlipY).ToList();
var RTL = draw.Layers.Select(x => x.RightToLeft).ToList();
var tRadius = draw.Layers.Select(x => x.arcRadius).ToList();
var tAngle = draw.Layers.Select(x => x.arcAngle).ToList();
var spacing = draw.Layers.Select(x => x.arcSpaces).ToList();
var txtLocation = draw.Layers.Select(x => x.locationText).ToList();
var moveX = draw.Layers.Select(x => x.moveX).ToList();
var moveY = draw.Layers.Select(x => x.moveY).ToList();
c# linq
New contributor
I am using LINQ to get a list of variables in a list of objects, but it seems long. Is there a way to minimize these? How do I refactor this line of codes?
var _text = draw.Layers.Select(x => x._Text).ToList();
var family = draw.Layers.Select(x => x.Family).ToList();
var fontSize = draw.Layers.Select(x => x.Size).ToList();
var style = draw.Layers.Select(x => x.Style).ToList();
var fillType = draw.Layers.Select(x => x.fillType).ToList();
var both = draw.Layers.Select(x => x.textBoth).ToList();
var width = draw.Layers.Select(x => x.textW).ToList();
var height = draw.Layers.Select(x => x.textH).ToList();
var centered = draw.Layers.Select(x => x.AlwaysCentered).ToList();
var rAngle = draw.Layers.Select(x => x.angle).ToList();
var origin = draw.Layers.Select(x => x.origin).ToList();
var offset = draw.Layers.Select(x => x.offset).ToList();
var mirror = draw.Layers.Select(x => x.mirrored).ToList();
var align = draw.Layers.Select(x => x.AlignToArc).ToList();
var flipY = draw.Layers.Select(x => x.FlipY).ToList();
var RTL = draw.Layers.Select(x => x.RightToLeft).ToList();
var tRadius = draw.Layers.Select(x => x.arcRadius).ToList();
var tAngle = draw.Layers.Select(x => x.arcAngle).ToList();
var spacing = draw.Layers.Select(x => x.arcSpaces).ToList();
var txtLocation = draw.Layers.Select(x => x.locationText).ToList();
var moveX = draw.Layers.Select(x => x.moveX).ToList();
var moveY = draw.Layers.Select(x => x.moveY).ToList();
c# linq
c# linq
New contributor
New contributor
New contributor
asked 21 hours ago
HEWhoDoesn'tKnow
972
972
New contributor
New contributor
put on hold as unclear what you're asking by Heslacher, t3chb0t, Toby Speight, VisualMelon, Denis 18 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by Heslacher, t3chb0t, Toby Speight, VisualMelon, Denis 18 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
3
Is there any reason why you can't simply usedraw.layers
instead of getting every property of it?
– Bruno Costa
21 hours ago
2
The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review - Asking Questions for guidance on writing good question titles.
– BCdotWEB
21 hours ago
add a comment |
3
Is there any reason why you can't simply usedraw.layers
instead of getting every property of it?
– Bruno Costa
21 hours ago
2
The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review - Asking Questions for guidance on writing good question titles.
– BCdotWEB
21 hours ago
3
3
Is there any reason why you can't simply use
draw.layers
instead of getting every property of it?– Bruno Costa
21 hours ago
Is there any reason why you can't simply use
draw.layers
instead of getting every property of it?– Bruno Costa
21 hours ago
2
2
The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review - Asking Questions for guidance on writing good question titles.
– BCdotWEB
21 hours ago
The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review - Asking Questions for guidance on writing good question titles.
– BCdotWEB
21 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
3
Is there any reason why you can't simply use
draw.layers
instead of getting every property of it?– Bruno Costa
21 hours ago
2
The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review - Asking Questions for guidance on writing good question titles.
– BCdotWEB
21 hours ago