Always thought that the control's Tag property is similar to the TextBox's Text property, just to save the user's markup on the control of the text information or Boolean value, so after seeing the code below, it feels a bit confused.
<span style= "FONT-SIZE:18PX;" >listviewitem item = LISTVIEWCHANNELS.ITEMS.ADD (devicename);
Item. Tag = ipcchannel;</span>
The function of the above code is to create a ListViewItem object and set its tag value to a custom class-IpcChannel object.
<span style= "FONT-SIZE:18PX;" >channellist.add (item. Tag as IpcChannel);</span>
The purpose of this code is to extract the object of the custom class IpcChannel saved in the Tag property of the item of the ListViewItem class created above and add it to the list.
Check the back before you know, the original Tag property is defined as follows:
<span style= "FONT-SIZE:18PX;" >public Object Tag {get; set;} </span>
Definition reference MSDN;
And in. NET is derived from the object class, you can set the value of any custom type object or base type for the tag property to facilitate the program to read when necessary.