This project has moved. For the latest updates, please go here.

System.Collections.IDictionary Extension Methods

IDictionary.ToHashtable Method

An IDictionary extension method that converts the @this to a hashtable.

Syntax

Hashtable ToHashtable(IDictionary @this)

Parameters

@this
The @this to act on.

Examples


 // Copyright (c) 2013 Jonathan Magnan (http://zzzportal.com)
 // All rights reserved.
 // Licensed under MIT License (MIT)
 // License can be found here: https://zextensionmethods.codeplex.com/license
 
 using System.Collections;
 using System.Collections.Generic;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Z;
 
 namespace ExtensionMethods.Examples
 {
     [TestClass]
     public class System_Collections_IDictionary_ToHashtable
     {
         [TestMethod]
         public void ToHashtable()
         {
             // Type
             var @this = new Dictionary<string, string> {{"Fizz", "Buzz"}};
 
             // Examples
             Hashtable value = @this.ToHashtable(); // return the Dictionary as Hashtable
 
             // Unit Test
             Assert.AreEqual("Buzz", value["Fizz"]);
         }
     }
 }
                

Last edited Nov 23, 2013 at 6:52 PM by Jonathan_Magnan, version 1