|
-
Feb 23rd, 2006, 07:11 AM
#1
Thread Starter
Lively Member
Get and Set Help [RESOLVED]
Lo all,
having a little trouble with a few get and set properties im trying to do, ther reason why is they are part of an array. I can do this is vb6 pretty easy but dont know how to do it in C#.
Can someone point me in the right direction, currently I have this which is how it would be done if acAccountNote wasnt an array but unfortunatly it is hehe. Any ideas how to do this with an array??
VB Code:
private string AccountNote
{
get
{
return acAccountNote;
}
set
{
acAccountNote = value;
}
}
Last edited by Hack; Feb 23rd, 2006 at 09:09 AM.
Reason: Added green "resolved" checkmark
-
Feb 23rd, 2006, 07:20 AM
#2
Re: Get and Set Help
First of all I am confused. If you are creating a property why would it be private?
To have the property use array, you will need to declare the property as array
Code:
//private member that will hold the data
private string[] acAccountNote;
public string[] AccountNote
{
get
{
return acAccountNote;
}
set
{
acAccountNote = value;
}
}
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Feb 23rd, 2006, 07:21 AM
#3
Re: Get and Set Help
You can try
PHP Code:
public const int intCount = 10;
private static string[] _strArr = new int[intCount];
public static string [] MYPROPERTY
{
get { return _strArr; }
set { _strArr = value; }
}
But it'd be better to use an ArrayList or a similar collection.
-
Feb 23rd, 2006, 07:23 AM
#4
Thread Starter
Lively Member
Re: Get and Set Help
 Originally Posted by Shuja Ali
First of all I am confused. If you are creating a property why would it be private?
To have the property use array, you will need to declare the property as array
Code:
//private member that will hold the data
private string[] acAccountNote;
public string[] AccountNote
{
get
{
return acAccountNote;
}
set
{
acAccountNote = value;
}
}
oops sorry lol, it is public in my code just I typed it wrong on this hehe. guess i should start copy and pasting Thanks for the help it works now!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|