JamesRLamar
JamesRLamar

Reputation: 908

What is ColdFusion's equivalent to C# Something<>?

I'm working on an ASP.NET application and I'm trying to wrap my head around what it means when I see something like List<MyObject>. I actually have several other questions, but this is a good start. I've also tried finding some guides for migrating from ColdFusion to ASP MVC, but all I found was something from 2003. Thanks for any help :)

Upvotes: 0

Views: 268

Answers (3)

barnyr
barnyr

Reputation: 5678

The angle brackets notation you're referring to is called generics. They're necessary (or at least very useful) in a statically typed language like C# or Java. What they're saying is that this list is going to contain objects of type 'MyObject'.

Once you've declared what kind of Object the List can hold, the IDE (and possibly the runtime) can check your code to make sure that you're only putting objects of that type or subtype into the List.

Because ColdFusion is dynamically typed, the notion doesn't make sense, which is why you don't have the same notation in CFML/CFScript. The nearest equivalent to a List in Java/.Net is the Array in ColdFusion. That'll let you put any kind of value into it. You could think of an Array in ColdFusion of being equivalent to List.

Upvotes: 15

Dan Bracuk
Dan Bracuk

Reputation: 20804

The first part of your question has been answered. I will address the migration of CF applications to MVC .net. I'm currently in a similar situation.

The approach I suggest is to look at your CF app and write down everything that it does. Write it in such a way that it looks like a specification. Then use this document to write your new app.

If your CF app shares custom tags, udfs, cfcs, or other types of re-useable code with other CF apps, write this functionality into a .net class library. Then they will be available should you wish to migrate these other apps.

Good luck.

Upvotes: 1

Titouan D.
Titouan D.

Reputation: 476

List<MyObject>

Means you have a List object composed of MyObjectelements. I suggest you take a look at microsoft's documentation about the lists right here.

More generally I suggest you use the link above to find tutorials and answers to your potential questions, also you can take a look at this really great site for beginners dotnetperls. (for lists, take a look here)

Hope this helped

Upvotes: 6

Related Questions