My code is below, what I need from the sub quicker is if the first value in the array A is the same as every single other value in A, I could do it by typing out some large if statements but I would rather not do that.
Thanks in advance
Public Function Areas_Of_England_Checker()
Dim South_East() As System.Drawing.Color = {Oxfordshire.BackColor, Buckinhamshire.BackColor, Berkshire.BackColor, Hampshire.BackColor, Isle_Of_White.BackColor, West_Sussex.BackColor, Kent.BackColor, Surrey.BackColor, London.BackColor}
Dim South_West() As System.Drawing.Color = {Devon.BackColor, Cornwall.BackColor, Somerset.BackColor, Whiltshire.BackColor, Gloucestershire.BackColor, Dorset.BackColor}
Dim East_Anglia() As System.Drawing.Color = {Hertfordshire.BackColor, Bedfordshire.BackColor, Cambridgeshire.BackColor, Essex.BackColor, Suffolk.BackColor, Norfolk.BackColor, Northamptonshire.BackColor}
Dim East_Midlands() As System.Drawing.Color = {Lincolnshire.BackColor, Nottinghamshire.BackColor, Leicestershire.BackColor, Derbyshire.BackColor}
Dim West_Midlands() As System.Drawing.Color = {Shropshire.BackColor, Staffordshire.BackColor, Herefordshire.BackColor, Worcestershire.BackColor, Warwickshire.BackColor, Cheshire.BackColor}
Dim North_West() As System.Drawing.Color = {Manchester.BackColor, Merseyside.BackColor, Lancashire.BackColor, Cumbria.BackColor}
Dim Yorkshire() As System.Drawing.Color = {North_Yorkshire.BackColor, West_Yorkshire.BackColor, South_Yorkshire.BackColor, East_Yorkshire.BackColor}
Dim North_East() As System.Drawing.Color = {Northumberland.BackColor, County_Durham.BackColor}
quicker(South_East, 9)
quicker(South_West, 6)
quicker(East_Anglia, 7)
quicker(East_Midlands, 6)
quicker(North_West, 4)
quicker(Yorkshire, 4)
quicker(North_East, 2)
End Function
Public Sub quicker(A As Array, B As Integer)
If A(0) Is the same as any value in A Then ' sort-of pseudo-code
resupplytroops += B
End If
End Sub
HashSet<System.Drawing.Color>instead of arrays. Then you can call.Contains.a.Count == b.Count && a.All(x => b.Contains(x));