Skip to content

Commit a7a0622

Browse files
committed
Use ReadOnlyCollection
1 parent cfadbfe commit a7a0622

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

RetailCoder.VBE/Common/DeclarationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static bool HasMultipleDeclarationsInStatement(this Declaration target)
7979

8080
var statement = target.Context.Parent as VBAParser.VariableListStmtContext;
8181

82-
return statement != null && statement.children.OfType<VBAParser.VariableSubStmtContext>().Any();
82+
return statement != null && statement.children.OfType<VBAParser.VariableSubStmtContext>().Count() > 1;
8383
}
8484

8585
/// <summary>

RetailCoder.VBE/Refactorings/ExtractInterface/ExtractInterfaceModel.cs

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Collections.ObjectModel;
23
using System.Linq;
34
using Rubberduck.Parsing.Grammar;
45
using Rubberduck.Parsing.Symbols;
@@ -24,40 +25,30 @@ public class ExtractInterfaceModel
2425
public string InterfaceName { get; set; }
2526
public List<InterfaceMember> Members { get; set; }
2627

27-
private static DeclarationType[] DeclarationTypes
28+
private static readonly DeclarationType[] _declarationTypes =
2829
{
29-
get
30-
{
31-
return new[]
32-
{
33-
DeclarationType.Class,
34-
DeclarationType.Document,
35-
DeclarationType.UserForm
36-
};
37-
}
38-
}
30+
DeclarationType.Class,
31+
DeclarationType.Document,
32+
DeclarationType.UserForm
33+
};
34+
public ReadOnlyCollection<DeclarationType> DeclarationTypes = new ReadOnlyCollection<DeclarationType>(_declarationTypes);
3935

40-
public static string[] PrimitiveTypes
36+
private static readonly string[] _primitiveTypes =
4137
{
42-
get
43-
{
44-
return new[]
45-
{
46-
Tokens.Boolean,
47-
Tokens.Byte,
48-
Tokens.Date,
49-
Tokens.Decimal,
50-
Tokens.Double,
51-
Tokens.Long,
52-
Tokens.LongLong,
53-
Tokens.LongPtr,
54-
Tokens.Integer,
55-
Tokens.Single,
56-
Tokens.String,
57-
Tokens.StrPtr
58-
};
59-
}
60-
}
38+
Tokens.Boolean,
39+
Tokens.Byte,
40+
Tokens.Date,
41+
Tokens.Decimal,
42+
Tokens.Double,
43+
Tokens.Long,
44+
Tokens.LongLong,
45+
Tokens.LongPtr,
46+
Tokens.Integer,
47+
Tokens.Single,
48+
Tokens.String,
49+
Tokens.StrPtr
50+
};
51+
public ReadOnlyCollection<string> PrimitiveTypes = new ReadOnlyCollection<string>(_primitiveTypes);
6152

6253
public ExtractInterfaceModel(RubberduckParserState parseResult, QualifiedSelection selection)
6354
{

0 commit comments

Comments
 (0)