문제

Might seems silly question and can learn from google but I am new to C# and trying to figure out possible future clarifications. So here is best places to ask.

For example: Why do not we write;

XmlWriter writer = new XmlWriter("C:\\1.xml",settings);

instead writing;

XmlWriter writer = XmlWriter.Create("C:\\1.xml",settings);

(No new keyword and .Create method.)

What is XmlWriter fully named as a class?

Also how do I know in BCL which class to instantiate how? Like how do I know its syntax if I do not know. What is the ieasy way? How can intelligence help me?

도움이 되었습니까?

해결책

Because this is a factory method, it creates one of the derived classes like XmlWellFormedWriter, XmlAsyncCheckWriter, etc. which depend on settings.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top