I am trying to write a component in C # that will be used by classic ASP, which allows me to access the component's index (as a default property).
For example:
Component C #:
public class MyCollection { public string this[string key] { get { } } public void Add(string key, string value) { } }
ASP user:
Dim collection Set collection = Server.CreateObject("MyCollection ") Call collection.Add("key", "value") Response.Write(collection("key")) ' should print "value"
Is there an attribute that I need to set, do I need to implement an interface, or do I need to do something else? Or is this not possible through COM Interop?
The goal is that I'm trying to create double tests for some built-in ASP objects, such as Request, that use collections using these properties by default (for example, Request.QueryString("key") ). Alternative suggestions are welcome.
Update: I asked the following question: Why is the indexer on my .NET component not always accessible from VBScript?
collections c # vbscript asp-classic com-interop
Mike Henry
source share