Re: How to CAST string into object (hashtable)
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 10/18/04
- Next message: Jon Skeet [C# MVP]: "Re: How to create a class"
- Previous message: Arne Janning: "Re: How to create dynamically name of object?"
- In reply to: Peter: "How to CAST string into object (hashtable)"
- Next in thread: James Curran: "Re: How to CAST string into object (hashtable)"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 18 Oct 2004 02:58:07 +0100
Peter <pkorikov@hotmail.com> wrote:
> I'm a new in C# and have a problem
>
> I need to create dynamically the name of object
Objects don't have names. Variables have names, but objects don't
(generally).
> let's say "obj1", "obj2" etc. They're hashtables (Action Script
> objects)
>
> I'm doing like
> String tempStr = "obj" + i.ToString();
> then
> ASObject tempStr = new ASObject();
> this gives an problem, beacuse temStr is already defined as a string
> and recasting in this context is not possible.
>
> Java and VB can easy resolve it, not speaking about scripting
> languages were exists special functions like Eval(), but C# has some
> different way.
I presume by "Java" here you actually mean Javascript.
> If somebody knows something about it?
Either use an array of objects, or use a hashtable mapping from name to
object.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Jon Skeet [C# MVP]: "Re: How to create a class"
- Previous message: Arne Janning: "Re: How to create dynamically name of object?"
- In reply to: Peter: "How to CAST string into object (hashtable)"
- Next in thread: James Curran: "Re: How to CAST string into object (hashtable)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|