{"id":535,"date":"2005-05-09T00:56:36","date_gmt":"2005-05-08T22:56:36","guid":{"rendered":"http:\/\/10.0.0.2\/wordpress\/?p=535"},"modified":"2005-05-09T00:56:36","modified_gmt":"2005-05-08T22:56:36","slug":"learning_c_aargh","status":"publish","type":"post","link":"https:\/\/www.switchbl8.nl\/blog\/2005\/05\/learning_c_aargh\/","title":{"rendered":"Learning C# &#8211; aargh!"},"content":{"rendered":"<p>Because of the filesize, I decided to split up my main .cs file into smaller pieces. The namespace is E2O everywhere, and one of the files I created should hold all database-related stuff. So, it looks like this:<\/p>\n<p><code><br \/>\nnamespace E2O<br \/>\n{<br \/>\n\t public class DB<br \/>\n\t{<br \/>\n\t\t public DB()<br \/>\n\t\t {<br \/>\n\t\t\t \/\/constructor<br \/>\n\t\t }<br \/>\n<\/code><code><br \/>\n\t\t public static void xyz()<br \/>\n\t\t {<br \/>\n\t\t\t if(E2O.frmMain.checkbox1.Checked)<br \/>\n\t\t\t {<br \/>\n\t\t\t        blabla...<br \/>\n\t\t\t }<br \/>\n\t\t }<br \/>\n\t}<br \/>\n}<\/p>\n<p><\/code><\/p>\n<p>Now why can&#8217;t I refer to checkbox1? The compiler gives the error:<br \/>\n<em>An object reference is required for the nonstatic field, method, or property &#8216;E2O.frmMain.checkBox1&#8217;<\/em><br \/>\nThe object is defined as public (not the default private), but I can&#8217;t get to it. HOW? I know, I should probably go out and buy a C# book, but the only thing I want to accomplish is make the maintainability a little easier, the functions work perfectly when they are in one big file.<\/p>\n<p>If anybody knows, please comment, your help will be greatly appreciated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because of the filesize, I decided to split up my main .cs file into smaller pieces. The namespace is E2O everywhere, and one of the files I created should hold all database-related stuff. So, it looks like this: namespace E2O { public class DB { public DB() { \/\/constructor } public static void xyz() { <a href='https:\/\/www.switchbl8.nl\/blog\/2005\/05\/learning_c_aargh\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,8,10],"tags":[],"class_list":["post-535","post","type-post","status-publish","format-standard","hentry","category-c","category-development","category-e-sync","category-39-id","category-8-id","category-10-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/comments?post=535"}],"version-history":[{"count":0,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/535\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/media?parent=535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/categories?post=535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/tags?post=535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}