Skip to content

Commit

Permalink
Merge pull request #868 from Redth/ienumerable
Browse files Browse the repository at this point in the history
Use IEnumerable for PossibleFormats
  • Loading branch information
Redth committed Mar 14, 2020
2 parents c667b8f + 12caff1 commit 9e0dedd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions ZXing.Net.Mobile/MobileBarcodeScanningOptions.shared.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using ZXing;

namespace ZXing.Mobile
Expand All @@ -24,7 +25,7 @@ public MobileBarcodeScanningOptions()

public CameraResolutionSelectorDelegate CameraResolutionSelector { get; set; }

public List<BarcodeFormat> PossibleFormats { get; set; }
public IEnumerable<BarcodeFormat> PossibleFormats { get; set; }

public bool? TryHarder { get; set; }

Expand Down Expand Up @@ -75,7 +76,7 @@ public BarcodeReader BuildBarcodeReader()
if (AssumeGS1.HasValue)
reader.Options.AssumeGS1 = AssumeGS1.Value;

if (PossibleFormats != null && PossibleFormats.Count > 0)
if (PossibleFormats?.Any() ?? false)
{
reader.Options.PossibleFormats = new List<BarcodeFormat>();

Expand All @@ -97,7 +98,7 @@ public MultiFormatReader BuildMultiFormatReader()
if (PureBarcode.HasValue && PureBarcode.Value)
hints.Add(DecodeHintType.PURE_BARCODE, PureBarcode.Value);

if (PossibleFormats != null && PossibleFormats.Count > 0)
if (PossibleFormats?.Any() ?? false)
hints.Add(DecodeHintType.POSSIBLE_FORMATS, PossibleFormats);

reader.Hints = hints;
Expand Down
2 changes: 1 addition & 1 deletion ZXing.Net.Mobile/iOS/AVCaptureScannerView.ios.cs
Expand Up @@ -222,7 +222,7 @@ bool SetupCaptureSession()
session.AddOutput(metadataOutput);

//Setup barcode formats
if (ScanningOptions.PossibleFormats != null && ScanningOptions.PossibleFormats.Count > 0)
if (ScanningOptions?.PossibleFormats?.Any() ?? false)
{
var formats = AVMetadataObjectType.None;

Expand Down

0 comments on commit 9e0dedd

Please sign in to comment.