winforms - C# - Partial Class in the VS2005 project -


संभव डुप्लिकेट:

मैं VS2005 प्रोजेक्ट में आंशिक वर्ग कैसे जोड़ सकता हूं ताकि यह मुख्य फ़ाइल के लिए फ़ाइल के पीछे कोड के रूप में दिखाई दे?

उदाहरण के लिए: मैं अपने वर्ग की संपत्तियों को नामित फ़ाइल में रखना चाहता हूं, MyClass.cs और मैं MyClass.attr.cs नाम की फ़ाइल में मेरे क्लास-एट्रिब्यूट को रखना चाहते हैं।

जब मैं वीएस 2005 प्रोजेक्ट खोलता हूं, MyClass.attr.cs -फ़ाइल MyClass.cs के लिए फ़ाइल के पीछे एक कोड के रूप में दिखाई देगा, जैसे Form1.cs और फॉर्म 1। डिज़ाइनर सीएस एक विनफ़ॉर्म एप्लिकेशन में।

अपने .csproj फ़ाइल में 'कक्षाओं के लिए अलग टैग देखेंगे, जैसे:

  & lt; संकलन शामिल करें = "MyClass.attr.cs" / & gt; & Lt; संकलन शामिल करें = "MyClass.cs" / & gt;  

MyClass.attr.cs के लिए प्रविष्टि को इस तरह बदलें:

  & lt; compile शामिल करें = "MyClass attr.cs "& gt; & LT; DependentUpon & gt; MyClass.cs & lt; / DependentUpon & gt; & Lt; / संकलित & gt;  

Comments

Popular posts from this blog

c# - PInvoke of NetUserAdd returns 24 -

c# - XMLDocument.Validate Error: System.InvalidOperationException : The XmlSchemaSet on the document is either null or has no schemas in it -