{"id":686,"date":"2017-01-18T10:52:57","date_gmt":"2017-01-18T10:52:57","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=431"},"modified":"2026-06-17T09:26:19","modified_gmt":"2026-06-17T08:26:19","slug":"partial-classes","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/classes-uwp-programming-in-c\/partial-classes\/partial-classes","title":{"rendered":"Partial Classes"},"content":{"rendered":"<p>Yopu may want to spliit a class definition when:<\/p>\n<p style=\"margin-left: 40px\">\n\tWhen working on large projects, spreading a class over separate files enables multiple programmers to work on it at the same time.<\/p>\n<p style=\"margin-left: 40px\">\n\tWhen working with automatically generated source, code can be added to the class without having to recreate the source file. Visual Studio uses this approach when it creates Windows Forms, Web service wrapper code, and so on. You can create code that uses these classes without having to modify the file created by Visual Studio.<\/p>\n<p>\tTo split a class definition, use the &#8216;partial&#8217; keyword for all declarations of the class:<\/p>\n<pre><code>\nnamespace MyProjectsNamespace\n{\n\tpartial class MyClassName\n\t{\n<\/code><\/pre>\n<p>or<\/p>\n<pre><code>\nnamespace MyProjectsNamespace\n{\n\tpublic partial class MyClassName\n\t{\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yopu may want to spliit a class definition when: When working on large projects, spreading a class over separate files enables multiple programmers to work on it at the same time. When working with automatically generated source, code can be added to the class without having to recreate the source file. Visual Studio uses this [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[143],"tags":[],"class_list":["post-686","post","type-post","status-publish","format-standard","hentry","category-partial-classes"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=686"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/686\/revisions"}],"predecessor-version":[{"id":1197,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/686\/revisions\/1197"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}