2
Reply

Dont know how to assign value to ENUM property in a class

rahul shekar

rahul shekar

Aug 5 2016 3:05 AM
255
<table style="border-collapse: collapse; table-layout: fixed; border-spacing: 0px; outline: 0px; font-size: 13px; color: #242729; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; background-color: #ffffff;"><tbody style=" 0px; 0px;"><tr style=" 0px; 0px;"><td style=" 0px; 0px; min- 1px; outline: 0px; 19px; font-size: 15px; 445px; word-wrap: break-word; 1.3; vertical-align: top; max- 445px;"><p style=" 0px; 0px; clear: both;"><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">Here it is my code</span><br /></p><div><div style=" 0px; 0px;"> public partial class VerifyAccountType<br /> {<br /> private BacsCodeType bacsCodeField;</div><div style=" 0px; 0px;"> public BacsCodeType bacsCode<br /> {<br /> get<br /> {<br /> return this.bacsCodeField;<br /> }<br /> set<br /> {<br /> this.bacsCodeField = value;<br /> }<br /> }<br /> }</div><div style=" 0px; 0px;"> public partial class BacsCodeType<br /> {<br /> private BACScode codeField;</div><div style=" 0px; 0px;"> private BACSdescription valueField;</div><div style=" 0px; 0px;"> public BACScode code<br /> {<br /> get<br /> {<br /> return this.codeField;<br /> }<br /> set<br /> {<br /> this.codeField = value;<br /> }<br /> }</div><div style=" 0px; 0px;"> public BACSdescription Value<br /> {<br /> get<br /> {<br /> return this.valueField;<br /> }<br /> set<br /> {<br /> this.valueField = value;<br /> }<br /> }<br /> }</div><div style=" 0px; 0px;"> public enum BACScode<br /> {<br /> B,</div><div style=" 0px; 0px;"> Item2,</div><div style=" 0px; 0px;"> Item5,<br /> }</div><div style=" 0px; 0px;"> public enum BACSdescription<br /> {<br /> Accountclosed,</div><div style=" 0px; 0px;"> Accountholderdeceased,</div><div style=" 0px; 0px;"> Accountdoesnotexist,<br /> }</div>&nbsp;</div><pre style=" 0px; 1em; 5px; 0px; font-size: 13px; auto; max- 600px; overflow: auto; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; word-wrap: normal; background-color: #eff0f1;"><p style=" 0px;"><span style="font-size: 15px; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; background-color: #ffffff;">Now</span><span style="font-size: 15px; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; color: #405a04; background: #d1e1ad;"> I can</span><span style="font-size: 15px; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; background-color: #ffffff;"> create an instance of </span><code style="font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif;"><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">VerifyAccountType</span></code><span style="font-size: 15px; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; background-color: #ffffff;"> </span><span style="font-size: 15px; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; color: #405a04; background: #d1e1ad;">as</span></p></pre><pre style=" 0px; 1em; 5px; 0px; font-size: 13px; auto; max- 600px; overflow: auto; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; word-wrap: normal; background-color: #eff0f1;"><code style=" 0px; 0px; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; "><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">oRtlO.accountInformation = new VerifyAccountType(); </span></code></pre><p style=" 0px; 0px; clear: both;"><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">Also</span> to access enum property<span style=" 0px; 0px; color: #405a04; background: #d1e1ad;"> I</span> create next instance,<br /></p><pre style=" 0px; 1em; 5px; 0px; font-size: 13px; auto; max- 600px; overflow: auto; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; word-wrap: normal; background-color: #eff0f1;"><code style=" 0px; 0px; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; "><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">oRtlO.accountInformation.bacsCode = new BacsCodeType(); </span></code></pre><p style=" 0px; 0px; clear: both;"><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">Now</span> my concern is how<span style=" 0px; 0px; color: #405a04; background: #d1e1ad;"> can I</span> assign value to<span style=" 0px; 0px; color: #405a04; background: #d1e1ad;"> the following?</span><br /></p><pre style=" 0px; 1em; 5px; 0px; font-size: 13px; auto; max- 600px; overflow: auto; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; word-wrap: normal; background-color: #eff0f1;"><code style=" 0px; 0px; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; "><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">oRtlO.accountInformation.bacsCode.code = ????; </span></code></pre><p style=" 0px; 0px; clear: both;"><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">I couldn't</span> assign string value for e.g as ""<br /></p><p style=" 0px; 0px; clear: both;"><span style=" 0px; 0px; color: #405a04; background: #d1e1ad;">Can anyone please</span> help<span style=" 0px; 0px; color: #405a04; background: #d1e1ad;"> me?</span></p></td></tr></tbody></table>

Answers (2)