Skip to content

Commit 97e3ab1

Browse files
Use IList instead of List where we can
In some cases, we use List#ToArray and List#Sort, which are not provided by IList. Those were not updated.
1 parent 45fb9d1 commit 97e3ab1

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

projects/client/Apigen/src/apigen/AmqpClass.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444

4545
namespace RabbitMQ.Client.Apigen {
4646
public class AmqpClass: AmqpEntity {
47-
public List<AmqpMethod> m_Methods;
48-
public List<AmqpField> m_Fields;
47+
public IList<AmqpMethod> m_Methods;
48+
public IList<AmqpField> m_Fields;
4949

5050
public AmqpClass(XmlNode n)
5151
: base(n)

projects/client/Apigen/src/apigen/AmqpMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444

4545
namespace RabbitMQ.Client.Apigen {
4646
public class AmqpMethod: AmqpEntity {
47-
public List<AmqpField> m_Fields;
48-
public List<string> m_ResponseMethods;
47+
public IList<AmqpField> m_Fields;
48+
public IList<string> m_ResponseMethods;
4949

5050
public AmqpMethod(XmlNode n)
5151
: base(n)

projects/client/Apigen/src/apigen/Apigen.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ public static string MangleConstant(string name) {
120120
return MangleClass(name);
121121
}
122122

123-
public static List<string> IdentifierParts(string name) {
124-
List<string> result = new List<string>();
123+
public static IList<string> IdentifierParts(string name) {
124+
IList<string> result = new List<string>();
125125
foreach (String s1 in name.Split(new Char[] { '-' })) {
126126
foreach (String s2 in s1.Split(new Char[] { ' ' })) {
127127
result.Add(s2);
@@ -173,9 +173,9 @@ public static string MangleMethodClass(AmqpClass c, AmqpMethod m) {
173173
public bool m_emitComments = false;
174174

175175
public Type m_modelType = typeof(RabbitMQ.Client.Impl.IFullModel);
176-
public List<Type> m_modelTypes = new List<Type>();
177-
public List<KeyValuePair<string, int>> m_constants = new List<KeyValuePair<string, int>>();
178-
public List<AmqpClass> m_classes = new List<AmqpClass>();
176+
public IList<Type> m_modelTypes = new List<Type>();
177+
public IList<KeyValuePair<string, int>> m_constants = new List<KeyValuePair<string, int>>();
178+
public IList<AmqpClass> m_classes = new List<AmqpClass>();
179179
public Dictionary<string, string> m_domains = new Dictionary<string, string>();
180180

181181
public static Dictionary<string, string> m_primitiveTypeMap;
@@ -232,7 +232,7 @@ public void Usage() {
232232
Environment.Exit(1);
233233
}
234234

235-
public Apigen(List<string> args) {
235+
public Apigen(IList<string> args) {
236236
while (args.Count > 0 && ((string) args[0]).StartsWith("/")) {
237237
HandleOption((string) args[0]);
238238
args.RemoveAt(0);
@@ -800,7 +800,7 @@ public Attribute Attribute(IEnumerable<object> attributes, Type t) {
800800
public void EmitModelImplementation() {
801801
EmitLine(" public class Model: RabbitMQ.Client.Impl.ModelBase {");
802802
EmitLine(" public Model(RabbitMQ.Client.Impl.ISession session): base(session) {}");
803-
List<MethodInfo> asynchronousHandlers = new List<MethodInfo>();
803+
IList<MethodInfo> asynchronousHandlers = new List<MethodInfo>();
804804
foreach (Type t in m_modelTypes) {
805805
foreach (MethodInfo method in t.GetMethods()) {
806806
if (method.DeclaringType.Namespace != null &&
@@ -1098,7 +1098,7 @@ public void EmitModelMethod(MethodInfo method) {
10981098
EmitLine(" }");
10991099
}
11001100

1101-
public void EmitAsynchronousHandlers(List<MethodInfo> asynchronousHandlers) {
1101+
public void EmitAsynchronousHandlers(IList<MethodInfo> asynchronousHandlers) {
11021102
EmitLine(" public override bool DispatchAsynchronous(RabbitMQ.Client.Impl.Command cmd) {");
11031103
EmitLine(" RabbitMQ.Client.Impl.MethodBase __method = (RabbitMQ.Client.Impl.MethodBase) cmd.Method;");
11041104
EmitLine(" switch ((__method.ProtocolClassId << 16) | __method.ProtocolMethodId) {");

projects/client/RabbitMQ.Client/src/client/impl/Command.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static void CheckEmptyFrameSize() {
8888
public MethodBase m_method;
8989
public ContentHeaderBase m_header;
9090
public byte[] m_body0;
91-
public List<byte[]> m_bodyN;
91+
public IList<byte[]> m_bodyN;
9292

9393
public MethodBase Method { get { return m_method; } }
9494
public ContentHeaderBase Header { get { return m_header; } }

projects/client/RabbitMQ.Client/src/util/SynchronizedList.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[Serializable]
88
internal class SynchronizedList<T> : IList<T>
99
{
10-
private readonly List<T> list;
10+
private readonly IList<T> list;
1111
private readonly object root;
1212

1313
public int Count
@@ -41,7 +41,7 @@ public T this[int index]
4141
}
4242
}
4343

44-
internal SynchronizedList(List<T> list)
44+
internal SynchronizedList(IList<T> list)
4545
{
4646
this.list = list;
4747
this.root = ((ICollection)list).SyncRoot;

projects/examples/wcf/Test/DuplexTest/Order.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace RabbitMQ.ServiceModel.Test.DuplexTest
4949
public class Order
5050
{
5151
private Guid m_id;
52-
private List<Pizza> m_items;
52+
private IList<Pizza> m_items;
5353
private DateTime m_ordered;
5454

5555
public Order()
@@ -67,7 +67,7 @@ public Guid Id
6767
}
6868

6969
[DataMember]
70-
public List<Pizza> Items
70+
public IList<Pizza> Items
7171
{
7272
get { return m_items; }
7373
set { m_items = value; }

projects/examples/wcf/Test/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void Main(string[] args)
7171
#endif
7272

7373
int passed = 0, failed = 0;
74-
List<ITestCase> tests = new List<ITestCase>();
74+
IList<ITestCase> tests = new List<ITestCase>();
7575
tests.Add(new OneWayTest.OneWayTest());
7676
tests.Add(new TwoWayTest.TwoWayTest());
7777
tests.Add(new SessionTest.SessionTest());

projects/examples/wcf/Test/SessionTest/Cart.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public Cart()
5555
}
5656

5757
private Guid m_id;
58-
private List<CartItem> m_items;
58+
private IList<CartItem> m_items;
5959

60-
private List<CartItem> Items {
60+
private IList<CartItem> Items {
6161
get { return m_items; }
6262
set { m_items = value; }
6363
}

0 commit comments

Comments
 (0)