473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

list<char> as properties of an objet

Hello, please look my code

Expand|Select|Wrap|Line Numbers
  1. public class dater
  2.     {
  3.         public new List<char> infoAa    
  4.         {
  5.             get { return this.infoAa;}
  6.             set { infoAa = value;}
  7.         }
  8.  
  9.         public void pasaAcadenaChar(string Cadena)
  10.         {
  11.             int i=0;
  12.             char pi;
  13.             while (i <= Cadena.Length)
  14.             {
  15.                 pi = (char)Cadena[i];
  16.                 infoAa.Add(pi);
  17.             }
  18.             i = 0;
  19.         }

I run the program and when try ths line: infoAa.Add(pi);

i have and stackOverflowExeption and the studio show this line:
get { return this.infoAa;}

i try to make a list of chart as a property and also i like to know how to make and array of char or anything as a property,

Thanks !!
Jan 19 '10 #1
3 2948
mzmishra
390 Expert 256MB
You can create array of string as a property .
Something like this.

Private strName As String() = New String() {"1", "2", "3"}

Public Property Name() As String()
Get
Return strName
End Get
Set(ByVal value As String())
strName = value
End Set
End Property
Jan 19 '10 #2
but that string is not dinamic and i need char one.
do you know how to use list<char>?

thanks
Jan 19 '10 #3
tlhintoq
3,525 Expert 2GB
The problem is that you have created a circular reference / infinite loop
Expand|Select|Wrap|Line Numbers
  1. public new List<char> infoAa    
  2.         {
  3.             get { return this.infoAa;}
  4.             set { infoAa = value;}
  5.         }
When you try to get infoAa, it then tries to return infoAa which means it needs to get InfoAa, so it returns infoAa, meaning it needs to get InfoAa [ repeat until crash ]

Same problem when setting.. you give a value to InfoAa which calls the 'set' which gives a value to InfoAa which call the 'set' [repeat until crash]

and you don't need the 'new' designator. Just take it out

Expand|Select|Wrap|Line Numbers
  1. public List<> infoAa
  2. {
  3.     get;
  4.     set;
  5. }
  6.  
Jan 20 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: alberto | last post by:
I am learning STL with the book STL Tutorial and Reference guide (1 edition), the following example don't run : int main() { // Initialize array a with 10 integers: int a = {12, 3, 25, 7, 11,...
2
by: ehui928 | last post by:
hi, everybody I am a newbie in STL. When I compile the following program under gcc4.0, I got a the following errors. I wonder whether the form of list< vector<string> > is correct in STL ? //...
3
by: Iwanow | last post by:
Hello! My goal is to develop a program that opens a bitmap, copies its pixels to an ArrayList in order to perform some complex calculations (edge detection, Hough transform etc.), and save...
6
by: Bobrick | last post by:
Hi. Thanks to everyone who replied to my last post, it turns out it wasn't the line where I was trying to treat the variable in question as an array which was the problem, but the line above. ...
44
by: Zytan | last post by:
The docs for List say "The List class is the generic equivalent of the ArrayList class." Since List<is strongly typed, and ArrayList has no type (is that called weakly typed?), I would assume...
45
by: Zytan | last post by:
This returns the following error: "Cannot modify the return value of 'System.Collections.Generic.List<MyStruct>.this' because it is not a variable" and I have no idea why! Do lists return copies...
3
by: Peterwkc | last post by:
Hello all expert C++ programmer, i fairly new to C++ programming. I have a class cellphone which contain dynamic pointer. I have create (example)ten cellphone. I want to ask user for the...
10
by: arnuld | last post by:
It is quite an ugly hack but it is all I am able to come up with for now :-( and it does the requires work. I want to improve the program, I know you people have much better ideas ;-) /* C++...
2
by: Fred Mellender | last post by:
I am trying to use reflection to output the fields (names and values) of an arbitrary object -- an object dump to a TreeView. It works pretty well, but I am having trouble with generic lists,...
3
by: banangroda | last post by:
Compilation fails at "line.insert(line.end(), x.begin(), i);" and I can't figure out why. Here is the code: /* 5-1. Design and implement a program to produce a permuted index. A permuted index...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.