public virtual T Item(
int index
) { get; set; }
Parameters
index The zero-based index of the element to get or set.
The item at the specified index.
using Leadtools;
using Leadtools.Dicom;
using Leadtools.Medical3D;
using Leadtools.Codecs;
using Leadtools.MedicalViewer;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;
using Leadtools.ImageProcessing.Color;
using Leadtools.Annotations.Engine;
using Leadtools.Annotations.Designers;
// Sample to test the MedicalViewerCollection class.
public void MedicalViewerCollectionExample()
{
MedicalViewerCollection<string> rc = new MedicalViewerCollection<string>();
rc.ItemAdded += new EventHandler<MedicalViewerCollectionEventArgs<string>>(MedicalViewerCollection_ItemAdded);
rc.ItemRemoved += new EventHandler<MedicalViewerCollectionEventArgs<string>>(MedicalViewerCollection_ItemRemoved);
// add a few items
string item1 = "item 1";
string item2 = "item 2";
string item3 = "item 3";
rc.Add(item1);
rc.Add(item2);
rc.Add(item3);
// insert an item
string newItem2 = "new item 2";
rc.Insert(1, newItem2);
// check if collection contains this new item
Assert.IsTrue(rc.Contains(newItem2));
// remove this new item
rc.Remove(newItem2);
Assert.IsTrue(!rc.Contains(newItem2));
// remove the last item
rc.RemoveAt(rc.Count - 1);
Assert.IsTrue(rc.Count == 2);
// send the first item to the end of the collection
rc.SendToBack(item1, true);
Assert.IsTrue(rc.IndexOf(item1) == rc.Count - 1);
// bring it back to the front
rc.BringToFront(item1, true);
Assert.IsTrue(rc.IndexOf(item1) == 0);
// copy to an array
string[] items = new string[rc.Count];
rc.CopyTo(items, 0);
Assert.IsTrue(items.Length == rc.Count);
for (int i = 0; i < items.Length; i++)
Assert.IsTrue(items[i] == rc[i]);
// loop throw the items and show them
foreach (string str in rc)
Console.WriteLine(str);
// clean the collection
rc.Clear();
Assert.IsTrue(rc.Count == 0);
}
private void MedicalViewerCollection_ItemAdded(System.Object sender, MedicalViewerCollectionEventArgs<string> e)
{
Console.WriteLine("The Item ((" + e.Item.ToString() + ")) Has been added to the collection");
}
private void MedicalViewerCollection_ItemRemoved(System.Object sender, MedicalViewerCollectionEventArgs<string> e)
{
Console.WriteLine("The Item ((" + e.Item.ToString() + ")) Has been removed from the collection");
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.