Current filter:
                                You should refresh the page.
                                We apologize for the inconvenience. Our ordering system and the support center may be offline for a few hours on Sunday, May 19 due to maintenance tasks.
                                0
                                  • Hi,

                                    For given class , when I try to move all the add rows to be as "Collection Iniitliazer is not work for me? What do I miss?
                                    Is it bug?

                                         #region Fileds
                                              private readonly LinearGradientBrush _HorizontalGradientBrush;
                                            private readonly Brush _brush;
                                            #endregion
                                       
                                           
                                              #region Constructor
                                              public PriorityToBrushConverter()
                                              {
                                                  _HorizontalGradientBrush = new LinearGradientBrush { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) };
                                                  _HorizontalGradientBrush.GradientStops.Add(
                                                      new GradientStop(Color.FromRgb(0xFF, 0x99, 0x99), 0));
                                                  _HorizontalGradientBrush.GradientStops.Add(
                                                      new GradientStop(Color.FromRgb(0xFF, 0x99, 0x33), 0.25));
                                                  _HorizontalGradientBrush.GradientStops.Add(
                                                      new GradientStop(Color.FromRgb(0xFF, 0x00, 0x66), 0.75));
                                                  _HorizontalGradientBrush.GradientStops.Add(
                                                      new GradientStop(Colors.Red, 1));
                                                  _brush = _HorizontalGradientBrush;
                                          }
                                              #endregion
                                         

                                    Thanks,
                                    Daniel Shitrit.

                                • Hi Daniel,

                                  Maybe our tool does not have this functionality for now and you want to create a suggestion? What result do you expect to see (please post small result sample)?

                                  Thanks,
                                  Andrew

                                • 01.24.2011

                                  Hi Andrew.

                                  This feature called Colllection Initilalizers from C# 3, you know it.

                                  Input:
                                  =====
                                  #region Constructor
                                            public PriorityToBrushConverter()
                                            {
                                                _HorizontalGradientBrush = new LinearGradientBrush { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) };
                                                _HorizontalGradientBrush.GradientStops.Add(
                                                    new GradientStop(Color.FromRgb(0xFF, 0x99, 0x99), 0));
                                                _HorizontalGradientBrush.GradientStops.Add(
                                                    new GradientStop(Color.FromRgb(0xFF, 0x99, 0x33), 0.25));
                                                _HorizontalGradientBrush.GradientStops.Add(
                                                    new GradientStop(Color.FromRgb(0xFF, 0x00, 0x66), 0.75));
                                                _HorizontalGradientBrush.GradientStops.Add(
                                                    new GradientStop(Colors.Red, 1));
                                                _brush = _HorizontalGradientBrush;
                                        }
                                            #endregion

                                  Output:
                                  ======

                                  #region Constructor
                                            public PriorityToBrushConverter()
                                            {
                                                _HorizontalGradientBrush = new LinearGradientBrush { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) };
                                                _HorizontalGradientBrush.GradientStops() {
                                              
                                                new GradientStop(Color.FromRgb(0xFF, 0x99, 0x99), 0),
                                               new GradientStop(Color.FromRgb(0xFF, 0x99, 0x99), 0.25),
                                                new GradientStop(Color.FromRgb(0xFF, 0x99, 0x99), 0.5),
                                                new GradientStop(Color.FromRgb(0xFF, 0x99, 0x99), 1)

                                              };

                                                               #endregion
                                  Thanks,
                                  Daniel Shitrit.

                                • Hi Daniel,

                                  Thanks for more information. I see your standpoint now. We don't support this functionality at present, but your idea sounds useful. Therefore, I have converted this Bug Report to a Suggestion.

                                  Thank,
                                  Andrew

                                • 01.24.2011

                                  Andrew,

                                  I have a CodeRush T-Shirt that is not update -:)
                                  with all my suggestions that are in satus of:
                                  (Accepted - Release TBD)

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi Daniel,
                                We just discovered that there is another ticket exist requesting the same functionality - Improve Convert to Initializer/Decompose Initializer to work on collection initializers as well. I'm going to close this ticket and add your ideas to the earlier ticket. Thank you for sharing your ideas with us.

                                You must  log in  or  register  to leave comments
                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.