In article <#uZZBLiXEHA.3012@tk2msftngp13.phx.gbl>, ken.kolda@elliemae-
nospamplease.com says...
[quoted text, click to view] > That's a great suggestion -- unfortunately, I've already tried it :)
>
> Whether I use the DispId attribute or not, because the property in question
> is a C# indexer it appears that regasm always mark it as the default
> property whether the DispId attribute is present or not.
Ok, wasn't sure if it would do that. Neat!
[quoted text, click to view] > I don't know if this is relevant, but the
> ClassInterface(ClassInterfaceType.None) at the assembly level so that I can
> define my own class interfaces for every class in my project. This has
> worked just fine to this point so I've assumed that doesn't have anything to
> do with the current problem.
I tried to reproduce your problem and was unable. Here's a quick
snippet of code I used. The only difference I see (based on your
description) is that I define an interface for my .NET classes and
they'll be the default interface since I also have the ClassInterface
(ClassInterfaceType.None) attribute applied to the assembly:
using System;
using System.Collections;
namespace DispIdZero
{
public interface IPerson
{
string FullName { get; set; }
}
public class CPerson : IPerson
{
private string m_Fullname = null;
public CPerson()
{
}
public string FullName
{
get { return m_Fullname; }
set { m_Fullname = value; }
}
}
public interface IPeople
{
IPerson this[string index]{ get; }
int Count { get; }
}
public class CPeople : IPeople
{
private Hashtable m_People = new Hashtable();
public CPeople()
{
IPerson p;
p = new CPerson();
p.FullName = "Bob Barker";
m_People.Add("BOB", p);
p = new CPerson();
p.FullName = "Mike Meyers";
m_People.Add("MIKE", p);
}
public IPerson this[string index]
{
get
{
return (IPerson) m_People[index];
}
}
public int Count
{
get
{
return 0;
}
}
}
}
Using REGASM (along with the /tlb option) I was able to get the
following VB6 code to work:
Dim people As CPeople
Set people = New CPeople
Debug.Print people.Item("BOB").FullName
Debug.Print people("BOB").FullName
Dim op As Object
Set op = New CPeople
Debug.Print op.Item("MIKE").FullName
Debug.Print op("MIKE").FullName
--
Patrick Steele
Microsoft .NET MVP