ChrisPulman/S7PlcRx

consider making AddUpdateTagItem public

Closed this issue · 3 comments

Hi, thx for your wonderful library.

I see RxS7 can add tags by this extension method

public static class ExtensionsMixins
{
    public static (ITag? tag, IRxS7? plc) AddUpdateTagItem<T>(this IRxS7 @this, string tagName, string address, int? arrayLength = null)
    {

However, sometimes the tag type is unknown at compile time. In that case, I can't add tag without hack (e.g. using reflection).

RxS7 does have an method that can add tag in which the concrete type is not required at compile time. Unfortunately, that is internal:

   internal void AddUpdateTagItem(Tag tag)
  • Is it suitable to make the internal AddUpdateTagItem(Tag tag) as well as the RemoveTagItem(string tagName) method public ?
  • Or, is it suitable to add two extension methods that pass the AddUpdateTagItem<T> in the form of AddUpdateTagItem(T t)? e.g.:
    • AddUpdateTagItem(this IRxS7 @this, Type type ,string tagName, string address, int? arrayLength = null)
    • (ITag? tag, IRxS7? plc) AddUpdateTagItem(this (ITag? _, IRxS7? plc) @this, Type type ,string tagName, string address, int? arrayLength = null)

Thank you for your feedback, I will try to get this added ASAP, I'm always open to idea's for improvement.

I have added the two AddUpdateTagItem extensions, the RemoveTagItem extension method already exists.
It will release as soon as the build completes, if you can test and confirm if this meets your needs, this would be great.

Thank you! It's people like you that make the world better and better