Exposing a .Net Class to COM, while it has a Private Generic type member
While studing to the 70-536 exam I faced this question:
You create the following class:
public class HomePage{
public StringBuilder currentHeadlines;
private string welcomMessage;
Array stockTickers;
Dictionary<int, string> priorityList;
}
You need to generate a type library for this class. The type library will be used by unmanaged codes.
What member should you update?
A. priv开发者_如何学Cate string welcomMessage.
B. public StringBuilder currentHeadlines.
C. Array stockTickers.
D. Dictionary priorityList. (Correct)
Why would be the option D the correct one, once this member is private?
I know that generic types cannot be exposed to com, but I also know that only public members are exposed. Can anyone clarify me?
Right, the correct answer is E. None of the above. For the reason you gave. They were trying to make you see that COM doesn't know anything about generics but fumbled the example. These sample exams always have a huge errata ("bug list"), be sure to dig it up. Here's one, not sure how complete it is. Having less-than-perfect documentation available otherwise models the software engineering profession pretty well.
精彩评论