media files. I need a "structure" to hold start and end positions of certain media files. Some
media files may need 20+ sets of "start" and "End" data and some may need only 1 for the
enire duration. So what is the best way to do this. So far I have:
|
Since those two variables (StartPoint and EndPoint) are so closely related to each media file I don't
want to create a seperate class for them. Should I make a list/array/collection of these structs, or
should I use something other that structs all togeather. From what I have read I should avoid structs and make a separate class but the two variable are tied closely to each media file and each media file could require multiple sets of the variables so what to I do? As I said I am a newbie so forgive my
ignorance. And thanks in advance to everyone for your patience and knowledge. =)
Sam HobbsPosted Nov 30, 2010, 8:38 PM
mark escoPosted Nov 30, 2010, 5:51 PM
the core implementation procedures for object-oriented programming. I
found a great site that helped me understand every thing I needed to
know plus some. If anyone is having similar issues with indexing complex
data structures, I recommend this site CSharpStation <-- This link starts
at tutorial 7 "Class Structures" and is a great - to the point - tutorial for
a thorough, yet brief overview of C#. As I did try to research my issue
before posting, I wasn't aware my problem was so fundamental simple,
and I apologize for the post. Anyway, maybe it helps some newbies = )
mark escoPosted Nov 26, 2010, 3:53 AM
something called a delegate to access the properties of that class. This seams like a long round about
way to do what I am trying to achieve so if anyone knows a better way to create and access multiple
instances of a class PLEASE let me know. Here is my code if anyone is having similar issues:
[code]
//Display folder selection to user //Is path good?
fbdPickFolder.ShowDialog();
if (fbdPickFolder.SelectedPath != "")
{
//Recieves files
string[] TempFiles;
MediaOptions.SearchFolder = fbdPickFolder.SelectedPath;
TempFiles = Directory.GetFiles(MediaOptions.SearchFolder);
//Isulates files with proper data
//Create a List<> of my MediaFiles class
List
for (int i = 0; i < TempFiles.Count(); i++)
{
//and the media files to the class via the constructor within the class
MediaFile.Add(new MediaFiles(TempFiles[i].ToString()));
}
//Use this delagate "p" I wish I could just access the properties directly through an index or string
MediaFile.ForEach(delegate(MediaFiles p)
{ MessageBox.Show(p.FilePath); }); //I verified the file names: Success!
}
else
{
MessageBox.Show("No Folder Selected!!!!");
}
[/code]