Try Playground
Show / Hide Table of Contents

Method RemoveRange

RemoveRange(Int32, Int32)

Removes a range of elements from the List<T>.

Declaration
void RemoveRange(int index, int count)
Parameters
Type Name Description
System.Int32 index

The zero-based starting index of the range of elements to remove.

System.Int32 count

The number of elements to remove.

Examples

The following code sample shows how to remove multiple of items from Distributed List.

ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedList";

IDistributedList<Product> list = cache.DataTypeManager.GetList<Product>(dataTypeName);
list.RemoveRange(25, 50);

RemoveRange(IEnumerable<T>)

Removes the elements of the specified collection from the List<T>.

Declaration
int RemoveRange(IEnumerable<T> collection)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<T> collection

The collection whose elements should be removed from the List<T>

Returns
Type Description
System.Int32

The number of removed elements.

Examples

The following code sample shows how to remove multiple of specified items from Distributed List.

ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedList";

IDistributedList<Product> list = cache.DataTypeManager.GetList<Product>(dataTypeName);

// Get range of expired products to be removed
Product[] newProducts = new Product[2];

newProducts[0] = new Product { Id = 1, Name = "Chai" };
newProducts[1] = new Product { Id = 2, Name = "Chang" };
newProducts[2] = new Product { Id = 3, Name = "Aniseed Syrup" };

int itemsRemoved = list.RemoveRange(newProducts);
In This Article
  • RemoveRange(Int32, Int32)
  • RemoveRange(IEnumerable<T>)

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
� Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top