Simplify collection initializers
MODIFY
WalletWasabi.Gui/Controls/QrEncoder/DataEncodation/ECISet.cs
WalletWasabi.Gui/Controls/QrEncoder/DataEncodation/ECISet.cs
@@ -181,9 +181,10 @@ namespace Gma.QrCodeNet.Encoding.DataEncodation
{
int eciValue = GetECIValueByName(encodingName);
- BitList dataBits = new BitList();
-
- dataBits.Add(ECIMode, ECIIndicatorNumBits);
+ BitList dataBits = new BitList
+ {
+ { ECIMode, ECIIndicatorNumBits }
+ };
int eciAssignmentByte = NumOfCodewords(eciValue);
//Number of bits = Num codewords indicator + codeword value = Number of codewords * 8

MODIFY
WalletWasabi.Gui/Controls/QrEncoder/EncodingRegion/FormatInformation.cs
WalletWasabi.Gui/Controls/QrEncoder/EncodingRegion/FormatInformation.cs
@@ -74,8 +74,10 @@ namespace Gma.QrCodeNet.Encoding.EncodingRegion
//xor maskPattern
formatInfo ^= s_FormatInfoMaskPattern;
- BitList resultBits = new BitList();
- resultBits.Add(formatInfo, 15);
+ BitList resultBits = new BitList
+ {
+ { formatInfo, 15 }
+ };
if (resultBits.Count != 15)
throw new Exception("FormatInfoBits length is not 15");

MODIFY
WalletWasabi.Gui/Controls/QrEncoder/EncodingRegion/VersionInformation.cs
WalletWasabi.Gui/Controls/QrEncoder/EncodingRegion/VersionInformation.cs
@@ -50,9 +50,11 @@ namespace Gma.QrCodeNet.Encoding.EncodingRegion
private static BitList VersionInfoBitList(int version)
{
- BitList result = new BitList();
- result.Add(version, s_LengthDataBits);
- result.Add(BCHCalculator.CalculateBCH(version, s_VersionBCHPoly), s_LengthECBits);
+ BitList result = new BitList
+ {
+ { version, s_LengthDataBits },
+ { BCHCalculator.CalculateBCH(version, s_VersionBCHPoly), s_LengthECBits }
+ };
if (result.Count != (s_LengthECBits + s_LengthDataBits))
throw new Exception("Version Info creation error. Result is not 18 bits");

MODIFY
WalletWasabi.Gui/Controls/QrEncoder/ReedSolomon/GeneratorPolynomial.cs
WalletWasabi.Gui/Controls/QrEncoder/ReedSolomon/GeneratorPolynomial.cs
@@ -19,8 +19,10 @@ namespace Gma.QrCodeNet.Encoding.ReedSolomon
internal GeneratorPolynomial(GaloisField256 gfield)
{
m_gfield = gfield;
- m_cacheGenerator = new List<Polynomial>(10);
- m_cacheGenerator.Add(new Polynomial(m_gfield, new int[] { 1 }));
+ m_cacheGenerator = new List<Polynomial>(10)
+ {
+ new Polynomial(m_gfield, new int[] { 1 })
+ };
}
/// <summary>

Simplify collection initializers