Dynamically Created Array of Object

G

Guest

I have a class like

public class keyword
{
blah......blah
}

and i have other class will use the keyword class

public class general
{
//i have to declare array of keyword class
keyword [] oKey;
int index = 0;
public void AddKey(string key)
{
oKey[index] = new keyword();
oKey[index].sKey = key;
index++;
}
}
the problem i have the oKey is null ,because i did not create an object from
keyword class, what is want is not declare a fixed size of keyword class like
keyword [] key = new keyword[10];
i need to dynamillcay create the keyword arrary.
any help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top