Skip to content

Commit 228d920

Browse files
Made code refactoring
1 parent 4a02182 commit 228d920

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

src/System.Windows.Forms.Design.Editors/src/System/Windows/Forms/Design/ListViewGroupCollectionEditor.cs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,28 @@
55
using System.ComponentModel;
66
using System.ComponentModel.Design;
77
using System.ComponentModel.Design.Serialization;
8-
using System.Diagnostics;
98

109
namespace System.Windows.Forms.Design
1110
{
12-
/// <include file='doc\ListViewGroupCollectionEditor.uex' path='docs/doc[@for="ListViewGroupCollectionEditor"]/*' />
13-
/// <devdoc>
14-
/// <para>
15-
/// Provides an editor for an image collection.</para>
16-
/// </devdoc>
11+
/// <summary>
12+
/// Provides an editor for an image collection.</para>
13+
/// </summary>
1714
internal class ListViewGroupCollectionEditor : CollectionEditor
1815
{
16+
object _editValue;
1917

20-
object editValue;
21-
/// <include file='doc\ListViewGroupCollectionEditor.uex' path='docs/doc[@for="ListViewGroupCollectionEditor.ListViewGroupCollectionEditor"]/*' />
22-
/// <devdoc>
23-
/// </devdoc>
2418
public ListViewGroupCollectionEditor(Type type) : base(type)
25-
{}
19+
{ }
2620

27-
/// <include file='doc\ListViewGroupCollectionEditor.uex' path='docs/doc[@for="ListViewGroupCollectionEditor.CreatesInstance"]/*' />
28-
/// <devdoc>
29-
/// Creates a ListViewGroup instance.
30-
/// </devdoc>
21+
/// <summary>
22+
/// Creates a ListViewGroup instance.
23+
/// </summary>
3124
protected override object CreateInstance(Type itemType)
3225
{
3326
ListViewGroup lvg = (ListViewGroup)base.CreateInstance(itemType);
3427

3528
// Create an unique name for the list view group.
36-
lvg.Name = CreateListViewGroupName((ListViewGroupCollection)this.editValue);
29+
lvg.Name = CreateListViewGroupName((ListViewGroupCollection)_editValue);
3730

3831
return lvg;
3932
}
@@ -42,22 +35,23 @@ private string CreateListViewGroupName(ListViewGroupCollection lvgCollection)
4235
{
4336
string lvgName = "ListViewGroup";
4437
string resultName;
45-
INameCreationService ncs = this.GetService(typeof(INameCreationService)) as INameCreationService;
46-
IContainer container = this.GetService(typeof(IContainer)) as IContainer;
38+
INameCreationService ncs = GetService(typeof(INameCreationService)) as INameCreationService;
39+
IContainer container = GetService(typeof(IContainer)) as IContainer;
4740

4841
if (ncs != null && container != null)
4942
{
5043
lvgName = ncs.CreateName(container, typeof(ListViewGroup));
5144
}
5245

5346
// strip the digits from the end.
54-
while (Char.IsDigit(lvgName[lvgName.Length - 1]))
47+
while (char.IsDigit(lvgName[lvgName.Length - 1]))
5548
{
5649
lvgName = lvgName.Substring(0, lvgName.Length - 1);
5750
}
5851

5952
int i = 1;
6053
resultName = lvgName + i.ToString(System.Globalization.CultureInfo.CurrentCulture);
54+
6155
while (lvgCollection[resultName] != null)
6256
{
6357
i++;
@@ -69,15 +63,15 @@ private string CreateListViewGroupName(ListViewGroupCollection lvgCollection)
6963

7064
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
7165
{
72-
this.editValue = value;
66+
_editValue = value;
7367
object ret;
7468

7569
// This will block while the ListViewGroupCollectionDialog is running.
7670
ret = base.EditValue(context, provider, value);
7771

7872
// The user is done w/ the ListViewGroupCollectionDialog.
7973
// Don't need the edit value any longer
80-
this.editValue = null;
74+
_editValue = null;
8175

8276
return ret;
8377
}

0 commit comments

Comments
 (0)