The problem: - I want to read filename into a List<> inside a class.
How to I read the filename into List<> in foreach Statement?
How to set up the get and set statement in List<> properties in the class.
For this operation, which type to use: static class or normal class?
------revise------------- This is the problem :
sorry for the confusion.
What I wanted is to add the filenames into the List<> in the class. I want to have a list of filename in the List for later use.
1) How do I add the filename into the List g_Photoname in the Class in Click Event or Page Load Event?
protected void Button_Click(object sender, EventArgs e)
{
//-1- Get all the files in Temp directory
var pe = new PicExample(@"c:\temp\");
foreach (string f in pe.FileList)
{
// Question : How do I add the f in the List<> in this class ?
// PhotoNameCollection = f ; ??? Can do?
}
}
2) Create a static class to hold the list of filename in the List<> in class
a) How do I set up the get ad set statement for the List<> in this class?
b) Is the List<> correcctly used in this class?
public class PhotoNameCollection
{
private List<string> g_Photoname
public List<string> PhotoName
{
get
{
}
set
{
}
}
}