使用 VB6 中的 bang(!) 运算符 return C# dll 中的对象

Using the bang(!) operator in VB6 to return an object in C# dll

在 ADO 中,有一个记录集对象,它允许您遍历显示以这种方式从列中获取值的行...

Do While Not someRecordSet.EOF 
    If someRecordSet!ColumnName <> "" Then
        ' do some logic
    End If
Loop

我想知道如何在我自己的 C# dll 中实现相同的行为(即使“!”非常不推荐使用)。

如有任何帮助,我们将不胜感激。

解决方案是定义一个以相同方式工作的索引器

public object this[string param] {
    get {
        if (!dict.ContainsKey(param))
            return "";
        return dict[param];
    }
    set {
        dict[param] = value;
    }
}