79 lines
25 KiB
Plaintext
79 lines
25 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en"><head>
|
|
<meta charset="UTF-8">
|
|
<title>Writing-C#</title>
|
|
<style>
|
|
@import url('https://styles.rokojori.com/get-font?family=Barlow&weights=100,400,700,900');
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<page--header></page--header>
|
|
|
|
<page--root>
|
|
<full--width--block>
|
|
<full--width--area><h1>Writing C#</h1></full--width--area>
|
|
</full--width--block>
|
|
<two--columns--block>
|
|
<two--columns--area><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="JaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="KaR"><span style="color: rgb(133, 250, 230);">B</span><span style="color: rgb(129, 248, 232);">R</span><span style="color: rgb(126, 247, 233);">A</span><span style="color: rgb(123, 245, 234);">C</span><span style="color: rgb(119, 243, 236);">K</span><span style="color: rgb(116, 242, 237);">E</span><span style="color: rgb(112, 240, 239);">T</span><span style="color: rgb(109, 239, 240);">S</span> <span style="color: rgb(106, 237, 242);">O</span><span style="color: rgb(102, 235, 243);">N</span> <span style="color: rgb(99, 234, 244);">N</span><span style="color: rgb(95, 232, 246);">E</span><span style="color: rgb(92, 231, 247);">W</span> <span style="color: rgb(89, 229, 249);">L</span><span style="color: rgb(85, 227, 250);">I</span><span style="color: rgb(82, 226, 252);">N</span><span style="color: rgb(78, 224, 253);">E</span></article-headline2> <br>
|
|
All brackets should be placed on a new line and not at the same line. </article-section></landscape--only></article-image-section><div><br><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="JaR"><landscape--only><article-section></article-section></landscape--only></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="MaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="NaR"><span style="color: rgb(133, 250, 230);">C</span><span style="color: rgb(126, 247, 233);">A</span><span style="color: rgb(119, 243, 236);">M</span><span style="color: rgb(112, 240, 239);">E</span><span style="color: rgb(106, 237, 242);">L</span><span style="color: rgb(99, 234, 244);">C</span><span style="color: rgb(92, 231, 247);">A</span><span style="color: rgb(85, 227, 250);">S</span><span style="color: rgb(78, 224, 253);">E</span></article-headline2> <br>
|
|
The default is in lowercase and camelcase. Only the following start with an uppercase:
|
|
class names, const/static/readonly members and only in C#: methods.</article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="MaR"><landscape--only><article-section><br></article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="MaR"><landscape--only><article-section></article-section></landscape--only></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="PaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="QaR"><span style="color: rgb(133, 250, 230);">T</span><span style="color: rgb(129, 248, 232);">A</span><span style="color: rgb(126, 246, 233);">B</span><span style="color: rgb(122, 245, 235);">S</span> <span style="color: rgb(118, 243, 236);">A</span><span style="color: rgb(115, 241, 238);">R</span><span style="color: rgb(111, 240, 239);">E</span> <span style="color: rgb(107, 238, 241);">T</span><span style="color: rgb(104, 236, 242);">W</span><span style="color: rgb(100, 234, 244);">O</span> <span style="color: rgb(97, 233, 245);">S</span><span style="color: rgb(93, 231, 247);">P</span><span style="color: rgb(89, 229, 248);">A</span><span style="color: rgb(86, 228, 250);">C</span><span style="color: rgb(82, 226, 251);">E</span><span style="color: rgb(78, 224, 253);">S</span></article-headline2> <br>
|
|
Never use real hard tabs use always soft tabs with two spaces. </article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="PaR"><landscape--only><article-section><br></article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="PaR"><landscape--only><article-section></article-section></landscape--only></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="SaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="TaR"><span style="color: rgb(133, 250, 230);">S</span><span style="color: rgb(131, 249, 231);">P</span><span style="color: rgb(128, 248, 232);">A</span><span style="color: rgb(126, 247, 233);">C</span><span style="color: rgb(124, 246, 234);">E</span> <span style="color: rgb(122, 245, 235);">F</span><span style="color: rgb(120, 244, 236);">O</span><span style="color: rgb(118, 243, 237);">R</span> <span style="color: rgb(115, 242, 237);">O</span><span style="color: rgb(113, 241, 238);">P</span><span style="color: rgb(111, 240, 239);">E</span><span style="color: rgb(109, 238, 240);">R</span><span style="color: rgb(107, 237, 241);">A</span><span style="color: rgb(105, 236, 242);">T</span><span style="color: rgb(102, 235, 243);">O</span><span style="color: rgb(100, 234, 244);">R</span><span style="color: rgb(98, 233, 245);">S</span> <span style="color: rgb(96, 232, 246);">&</span> <span style="color: rgb(94, 231, 247);">B</span><span style="color: rgb(92, 230, 248);">R</span><span style="color: rgb(89, 229, 248);">A</span><span style="color: rgb(87, 228, 249);">C</span><span style="color: rgb(85, 227, 250);">K</span><span style="color: rgb(83, 226, 251);">E</span><span style="color: rgb(81, 225, 252);">T</span><span style="color: rgb(78, 224, 253);">S</span></article-headline2> <br>
|
|
All operators should have spaces, brackets after openers and before closers. </article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="SaR"><landscape--only><article-section><br></article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="SaR"><landscape--only><article-section></article-section></landscape--only></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="VaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="WaR"><span style="color: rgb(133, 250, 230);">N</span><span style="color: rgb(130, 249, 231);">O</span> <span style="color: rgb(128, 248, 232);">P</span><span style="color: rgb(126, 246, 233);">A</span><span style="color: rgb(123, 245, 234);">R</span><span style="color: rgb(121, 244, 235);">A</span><span style="color: rgb(119, 243, 236);">M</span><span style="color: rgb(116, 242, 237);">E</span><span style="color: rgb(114, 241, 238);">T</span><span style="color: rgb(112, 240, 239);">R</span><span style="color: rgb(109, 239, 240);">I</span><span style="color: rgb(107, 237, 241);">C</span> <span style="color: rgb(104, 236, 242);">C</span><span style="color: rgb(102, 235, 243);">O</span><span style="color: rgb(100, 234, 244);">N</span><span style="color: rgb(97, 233, 245);">S</span><span style="color: rgb(95, 232, 246);">T</span><span style="color: rgb(93, 231, 247);">R</span><span style="color: rgb(90, 230, 248);">U</span><span style="color: rgb(88, 229, 249);">C</span><span style="color: rgb(86, 227, 250);">T</span><span style="color: rgb(83, 226, 251);">O</span><span style="color: rgb(81, 225, 252);">R</span><span style="color: rgb(78, 224, 253);">S</span></article-headline2> <br>
|
|
Don't create constructors that hide the no-parameters constructor. Use static functions with meaningful names
|
|
for instance creation. In most languages the best way is to not define any constructors. </article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="XaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="ZaR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="VaR"><landscape--only><article-section></article-section></landscape--only></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="XaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="ZaR"><span style="color: rgb(133, 250, 230);">E</span><span style="color: rgb(126, 247, 233);">A</span><span style="color: rgb(119, 243, 236);">R</span><span style="color: rgb(112, 240, 239);">L</span><span style="color: rgb(106, 237, 242);">Y</span> <span style="color: rgb(99, 234, 244);">E</span><span style="color: rgb(92, 231, 247);">X</span><span style="color: rgb(85, 227, 250);">I</span><span style="color: rgb(78, 224, 253);">T</span></article-headline2> <br>
|
|
Avoid nesting conditional statements and return/continue/break early when possible. </article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="baR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="caR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="XaR"><landscape--only><article-section></article-section></landscape--only></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="baR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="caR"><span style="color: rgb(133, 250, 230);">S</span><span style="color: rgb(129, 248, 232);">H</span><span style="color: rgb(124, 246, 234);">O</span><span style="color: rgb(120, 244, 235);">R</span><span style="color: rgb(116, 242, 237);">T</span> <span style="color: rgb(112, 240, 239);">F</span><span style="color: rgb(108, 238, 241);">U</span><span style="color: rgb(104, 236, 242);">N</span><span style="color: rgb(99, 234, 244);">C</span><span style="color: rgb(95, 232, 246);">T</span><span style="color: rgb(91, 230, 248);">I</span><span style="color: rgb(87, 228, 249);">O</span><span style="color: rgb(83, 226, 251);">N</span><span style="color: rgb(78, 224, 253);">S</span></article-headline2> <br>
|
|
Avoid deep and long functions with lots of instructions and inline documentation.
|
|
Just put a logical block into a function and give it a meaningful name. </article-section></landscape--only></article-image-section></div><div><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="eaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="faR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div><span style="background-color: var(--block--background--color); color: var( --color ); font-family: var( --font--family ); font-size: var( --font--scale ); letter-spacing: calc(-0.3px);"> </span></div></div></two--columns--area>
|
|
<two--columns--area><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="eaR"><article-headline2 data--gradient--text="" data-templates-id="faR"><span style="color: rgb(133, 250, 230);">N</span><span style="color: rgb(126, 247, 233);">O</span> <span style="color: rgb(119, 243, 236);">P</span><span style="color: rgb(112, 240, 239);">R</span><span style="color: rgb(106, 237, 242);">I</span><span style="color: rgb(99, 234, 244);">V</span><span style="color: rgb(92, 231, 247);">A</span><span style="color: rgb(85, 227, 250);">T</span><span style="color: rgb(78, 224, 253);">E</span></article-headline2><br>Don't make anything private - only protected. Don't use setters/getters that don't do anything. Everything can be public. Only stuff that really needs to be or will change in the future should be protected, most likely the following rule is better.</article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="haR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="iaR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="eaR"><article-section></article-section></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="haR"><article-headline2 data--gradient--text="" data-templates-id="iaR"><span style="color: rgb(133, 250, 230);">U</span><span style="color: rgb(130, 249, 231);">N</span><span style="color: rgb(128, 247, 232);">D</span><span style="color: rgb(125, 246, 233);">E</span><span style="color: rgb(123, 245, 234);">R</span><span style="color: rgb(120, 244, 235);">S</span><span style="color: rgb(118, 243, 236);">C</span><span style="color: rgb(115, 242, 237);">O</span><span style="color: rgb(113, 240, 238);">R</span><span style="color: rgb(111, 239, 239);">E</span> <span style="color: rgb(108, 238, 241);">P</span><span style="color: rgb(106, 237, 242);">R</span><span style="color: rgb(103, 236, 243);">E</span><span style="color: rgb(101, 235, 244);">F</span><span style="color: rgb(98, 233, 245);">I</span><span style="color: rgb(96, 232, 246);">X</span> <span style="color: rgb(93, 231, 247);">M</span><span style="color: rgb(91, 230, 248);">E</span><span style="color: rgb(88, 229, 249);">M</span><span style="color: rgb(86, 228, 250);">B</span><span style="color: rgb(83, 226, 251);">E</span><span style="color: rgb(81, 225, 252);">R</span><span style="color: rgb(78, 224, 253);">S</span></article-headline2><br>Rather use public members with an underscore prefix, when things are mainly used internally, or could change or are hard to understand. Underscores mean: "Please check/ask the doc/contributors for this variable or don't use it when you are not certain" </article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="kaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="laR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="haR"><article-section></article-section></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="kaR"><article-headline2 data--gradient--text="" data-templates-id="laR"><span style="color: rgb(133, 250, 230);">A</span><span style="color: rgb(129, 248, 232);">U</span><span style="color: rgb(124, 246, 234);">T</span><span style="color: rgb(120, 244, 235);">O</span><span style="color: rgb(116, 242, 237);">M</span><span style="color: rgb(112, 240, 239);">A</span><span style="color: rgb(108, 238, 241);">T</span><span style="color: rgb(104, 236, 242);">I</span><span style="color: rgb(99, 234, 244);">C</span> <span style="color: rgb(95, 232, 246);">T</span><span style="color: rgb(91, 230, 248);">Y</span><span style="color: rgb(87, 228, 249);">P</span><span style="color: rgb(83, 226, 251);">E</span><span style="color: rgb(78, 224, 253);">S</span></article-headline2><br>Use auto in C++ or var in C# when possible. </article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="naR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="oaR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="kaR"><article-section></article-section></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="naR"><article-headline2 data--gradient--text="" data-templates-id="oaR"><span style="color: rgb(133, 250, 230);">N</span><span style="color: rgb(131, 249, 231);">O</span><span style="color: rgb(128, 248, 232);">N</span><span style="color: rgb(126, 247, 233);">-</span><span style="color: rgb(124, 246, 234);">N</span><span style="color: rgb(122, 245, 235);">U</span><span style="color: rgb(120, 244, 236);">L</span><span style="color: rgb(118, 243, 237);">L</span><span style="color: rgb(115, 242, 237);">A</span><span style="color: rgb(113, 241, 238);">B</span><span style="color: rgb(111, 240, 239);">L</span><span style="color: rgb(109, 238, 240);">E</span> <span style="color: rgb(107, 237, 241);">C</span><span style="color: rgb(105, 236, 242);">L</span><span style="color: rgb(102, 235, 243);">A</span><span style="color: rgb(100, 234, 244);">S</span><span style="color: rgb(98, 233, 245);">S</span><span style="color: rgb(96, 232, 246);">E</span><span style="color: rgb(94, 231, 247);">S</span> <span style="color: rgb(92, 230, 248);">A</span><span style="color: rgb(89, 229, 248);">R</span><span style="color: rgb(87, 228, 249);">E</span> <span style="color: rgb(85, 227, 250);">E</span><span style="color: rgb(83, 226, 251);">V</span><span style="color: rgb(81, 225, 252);">I</span><span style="color: rgb(78, 224, 253);">L</span></article-headline2><br>Don't use non-nullable classes whenever possible. There was a reason null was invented 2000 years ago ;) </article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="qaR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="raR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="naR"><article-section></article-section></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="qaR"><article-headline2 data--gradient--text="" data-templates-id="raR"><span style="color: rgb(133, 250, 230);">L</span><span style="color: rgb(131, 249, 231);">E</span><span style="color: rgb(128, 248, 232);">F</span><span style="color: rgb(126, 247, 233);">T</span><span style="color: rgb(124, 246, 234);">-</span><span style="color: rgb(122, 245, 235);">H</span><span style="color: rgb(120, 244, 236);">A</span><span style="color: rgb(118, 243, 237);">N</span><span style="color: rgb(115, 242, 237);">D</span> <span style="color: rgb(113, 241, 238);">C</span><span style="color: rgb(111, 240, 239);">O</span><span style="color: rgb(109, 238, 240);">N</span><span style="color: rgb(107, 237, 241);">S</span><span style="color: rgb(105, 236, 242);">T</span> <span style="color: rgb(102, 235, 243);">I</span><span style="color: rgb(100, 234, 244);">N</span> <span style="color: rgb(98, 233, 245);">C</span><span style="color: rgb(96, 232, 246);">O</span><span style="color: rgb(94, 231, 247);">M</span><span style="color: rgb(92, 230, 248);">P</span><span style="color: rgb(89, 229, 248);">A</span><span style="color: rgb(87, 228, 249);">R</span><span style="color: rgb(85, 227, 250);">I</span><span style="color: rgb(83, 226, 251);">S</span><span style="color: rgb(81, 225, 252);">O</span><span style="color: rgb(78, 224, 253);">N</span></article-headline2><br>In comparisons, a const value should be on the left, the variable on the right. The only exceptions are null/undefined checks, they should always be right. </article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="taR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="uaR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="qaR"><article-section></article-section></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="taR"><article-headline2 data--gradient--text="" data-templates-id="uaR"><span style="color: rgb(133, 250, 230);">A</span><span style="color: rgb(127, 247, 232);">V</span><span style="color: rgb(122, 245, 235);">O</span><span style="color: rgb(116, 242, 237);">I</span><span style="color: rgb(111, 240, 239);">D</span> <span style="color: rgb(106, 237, 242);">S</span><span style="color: rgb(100, 234, 244);">W</span><span style="color: rgb(95, 232, 246);">I</span><span style="color: rgb(89, 229, 248);">T</span><span style="color: rgb(84, 227, 251);">C</span><span style="color: rgb(78, 224, 253);">H</span></article-headline2><br>Try to use if- and else-if-branches instead of switch.</article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="waR"><landscape--only><article-section><article-headline2 data--gradient--text="" data-templates-id="yaR"><span style="color: rgb(133, 250, 230);"><br></span></article-headline2></article-section></landscape--only></article-image-section></div><div style="color: rgb(146, 156, 175); letter-spacing: -0.3px;"><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="taR"><article-section></article-section></article-image-section><article-image-section data-image="::/_graphics/labs/godot/action-library-logo-only-white.svg" data-templates-id="waR"><article-headline2 data--gradient--text="" data-templates-id="yaR"><span style="color: rgb(133, 250, 230);">I</span><span style="color: rgb(127, 247, 233);">N</span><span style="color: rgb(121, 244, 235);">I</span><span style="color: rgb(115, 241, 238);">T</span><span style="color: rgb(109, 238, 240);">I</span><span style="color: rgb(103, 236, 243);">A</span><span style="color: rgb(97, 233, 245);">L</span><span style="color: rgb(91, 230, 248);">I</span><span style="color: rgb(85, 227, 250);">Z</span><span style="color: rgb(78, 224, 253);">E</span></article-headline2><br>Try to give all members initial values.</article-image-section></div></two--columns--area>
|
|
</two--columns--block><code--block data-language="rokojori-cs">
|
|
<code--area>public class MyClass
|
|
{
|
|
[Export]
|
|
public string name = "";
|
|
|
|
[Export]
|
|
public int value = 0;
|
|
|
|
public List<string> data = [];
|
|
|
|
public static MyClass Create( string name, int number = 1 )
|
|
{
|
|
var mc = new MyClass();
|
|
mc.name = name;
|
|
mc.value = value;
|
|
|
|
return mc;
|
|
}
|
|
|
|
|
|
public void doStuff( string command )
|
|
{
|
|
if ( command == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
if ( "set" == command )
|
|
{
|
|
value = 1;
|
|
}
|
|
else if ( "set:3" == command )
|
|
{
|
|
value = 3;
|
|
}
|
|
else if ( "data:4:x" == command )
|
|
{
|
|
data[ 4 ] = "x";
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
</code--area>
|
|
</code--block></page--root>
|
|
|
|
<page--footer></page--footer>
|
|
|
|
|
|
</body></html> |