Removes all items from the System.Collections.IList. Deals with null IList - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IList

Description

Removes all items from the System.Collections.IList. Deals with null IList

Demo Code


using System.Linq;
using System.Collections.Generic;
using System.Collections;
using System;//from  w w w . j a  v a 2 s  . c  o  m
using Cirrious.CrossCore.Platform;

public class Main{
        /// <summary>
        /// Removes all items from the System.Collections.IList.
        /// Deals with null IList
        /// </summary>
        /// <param name="source">The source.</param>
        public static void SafeClear(this IList source)
        {
            if (source != null)
                source.Clear();
        }
}

Related Tutorials