मेरे पास निम्न इंटरफ़ेस है जिसे मैं COM-Visual बनाने की कोशिश कर रहा हूं। जब मैं टाइप-लाइब्रेरी उत्पन्न करने का प्रयास करता हूं तो यह इस तथ्य को पसंद नहीं करता है कि मेरा कार्यान्वयन वर्ग जेनेरिक-क्लास से निकला है।क्या .NET जेनेरिक क्लास के साथ COM इंटरफ़ेस को कार्यान्वित करना संभव है?
क्या एक सामान्य वर्ग को COM कार्यान्वयन वर्ग के रूप में उपयोग करना संभव है? (मैं जानता हूँ कि मैं एक गैर सामान्य आवरण लिखना और COM के लिए है कि निर्यात कर सकता है, लेकिन यह एक और परत कि मैं नहीं बल्कि बिना नहीं था कहते हैं।)
[ComVisible(true)]
public interface IMyClass
{
...
}
[ComVisible(true), ComDefaultInterface(typeof(IMyClass))]
[ClassInterface(ClassInterfaceType.None)]
public class MyClass : BaseClass<IMyClass>, IMyClass
{
...
}
त्रुटि संदेश:
Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute.