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();









share|improve this question







New contributor




HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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 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















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();









share|improve this question







New contributor




HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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 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













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();









share|improve this question







New contributor




HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question







New contributor




HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 21 hours ago









HEWhoDoesn'tKnow

972




972




New contributor




HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






HEWhoDoesn'tKnow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




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 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














  • 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








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















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Create new schema in PostgreSQL using DBeaver

Deepest pit of an array with Javascript: test on Codility

Costa Masnaga