access .Net Hashtable in Coldfusion

.Net hashtable can be used as a Structure in coldfusion, below snippets explains the steps  

This Sample is for accessing the .Net Hashtable in Coldfusion

 Steps to be Followed

Create a Class Library which generate  Hashtable (collection or structure)

Call the .Net method from Coldfusion

.Net Code

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
public class HashTableDemo
public HashTableDemo()
public Hashtable getInfo()
Hashtable HTdemo = new Hashtable();
HTdemo.Add("Name","Vishnuprasad" );
HTdemo.Add("Age", 29);
HTdemo.Add("Sex", "Male");
HTdemo.Add("Mobile", 9884077182);
HTdemo.Add("Email", "");
HTdemo.Add("SkillSet", "Coldfusion, .Net , SQL Server, ORacle , Business Objects");
return HTdemo;



Above code will generate the DLL which needs to be used in Coldfusion as mentioned below with the path
CFM Code

type = "dotnet"
name = "Htdemo"
class = "HashTableDemo"
assembly ="d:/Vishnu/HashTableDemo.dll">
<cfset HCollection = #Htdemo.getInfo()#><cfoutput>
<table cellpadding = "2 " cellspacing = "2 ">
<!--- In cfloop, use item to create a variable
called person to hold value of key as loop runs --->
<cfloop collection = #HCollection# item = "Value">
<TD>#StructFind(HCollection, Value)#</TD>


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s