Class SeriennummernManager
Provides a managed wrapper around the microtech ERP IAutoSeriennummern interface for handling serial numbers in warehouse operations.
public class SeriennummernManager : ISeriennummernManager, IEnumerable<string>, IEnumerable
- Inheritance
-
objectSeriennummernManager
- Implements
Remarks
Since this wraps a COM interface, be cautious about performance implications when dealing with large collections.
Properties
Count
Gets the number of serial numbers currently in the collection.
public int Count { get; }
Property Value
this[int]
Gets the serial number at the specified index.
public string this[int index] { get; }
Parameters
indexintThe zero-based index of the serial number to retrieve.
Property Value
- string
The serial number at the specified index.
Exceptions
- ArgumentOutOfRangeException
Thrown when
indexis out of range.
Methods
Add(string)
Adds a serial number to the collection.
public int Add(string serialNumber)
Parameters
serialNumberstringThe serial number to add. Supports range syntax (e.g., "SN100..10" creates SN100 through SN109).
Returns
- int
The zero-based index at which the first number was inserted.
Exceptions
- ArgumentNullException
Thrown when
serialNumberis null or empty.
AddRange(IEnumerable<string>)
Adds multiple serial numbers to the collection.
public void AddRange(IEnumerable<string> serialNumbers)
Parameters
serialNumbersIEnumerable<string>The serial numbers to add.
Exceptions
- ArgumentNullException
Thrown when
serialNumbersis null.
Clear()
Removes all serial numbers from the collection.
public void Clear()
Contains(string)
Determines whether the collection contains the specified serial number.
public bool Contains(string serialNumber)
Parameters
serialNumberstringThe serial number to search for.
Returns
- bool
true if the serial number is found; otherwise, false.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<string> GetEnumerator()
Returns
- IEnumerator<string>
An enumerator that can be used to iterate through the collection.
HasDuplicates()
Checks whether there are duplicate serial numbers in the collection.
public bool HasDuplicates()
Returns
- bool
true if duplicates exist; otherwise, false.
IndexOf(string)
Returns the index of the specified serial number.
public int IndexOf(string serialNumber)
Parameters
serialNumberstringThe serial number to search for.
Returns
- int
The zero-based index of the serial number, or -1 if not found.
Pack(bool, bool)
Sorts and/or packs the serial numbers in the collection.
public void Pack(bool sort = true, bool pack = false)
Parameters
sortboolIf true, the serial numbers will be sorted.
packboolIf true, creates a compact representation of the serial numbers. Note: This parameter should not be used in COM context according to microtech ERP documentation.
Remove(string)
Removes the first occurrence of the specified serial number.
public bool Remove(string serialNumber)
Parameters
serialNumberstringThe serial number to remove.
Returns
- bool
true if the serial number was found and removed; otherwise, false.
RemoveAt(int)
Removes the serial number at the specified index.
public void RemoveAt(int index)
Parameters
indexintThe zero-based index of the serial number to remove.
Exceptions
- ArgumentOutOfRangeException
Thrown when
indexis out of range.
RemoveDuplicates()
Removes duplicate serial numbers from the collection.
public bool RemoveDuplicates()
Returns
- bool
true if duplicates were found and removed; otherwise, false.
Sort()
Sorts the serial numbers in the collection.
public void Sort()
ToList()
Gets all serial numbers as a list.
public List<string> ToList()