Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
Questionone to many class association Pin
chacimulch24-Aug-06 4:57
chacimulch24-Aug-06 4:57 
AnswerRe: one to many class association Pin
beatles169224-Aug-06 5:26
beatles169224-Aug-06 5:26 
Questionnot working still. Re: one to many class association [modified] Pin
chacimulch24-Aug-06 8:43
chacimulch24-Aug-06 8:43 
AnswerRe: not working still. Re: one to many class association Pin
beatles169224-Aug-06 21:05
beatles169224-Aug-06 21:05 
QuestionHelp with syntax. Re: one to many class association Pin
chacimulch25-Aug-06 2:36
chacimulch25-Aug-06 2:36 
AnswerRe: Help with syntax. Re: one to many class association Pin
beatles169225-Aug-06 3:03
beatles169225-Aug-06 3:03 
QuestionRe: Help with syntax. Re: one to many class association [modified] Pin
chacimulch25-Aug-06 3:51
chacimulch25-Aug-06 3:51 
AnswerRe: Help with syntax. Re: one to many class association Pin
beatles169225-Aug-06 12:10
beatles169225-Aug-06 12:10 
Hi Yse you can declare an empty array using this syntax:
<br />
object[] arr=new object[]{};<br />

Well an arraylist is a collection object that you can add other obejcts to it(using its Add method) and it has a lot of use,you can enumurate it using its enumurator and C# foreach keyword like this:
<br />
foreach(object obj in myArrayList)<br />
{<br />
do somthing with obj;<br />
}<br />

When you use AddRange method all the members of the passing array will be added to your arraylist it's something like:
<br />
foreach(object item in myArray)<br />
{<br />
myArrayList.Add(item);<br />
}<br />

We did this here because we wanted to save the current state of our object and then add a new item to our arraylist.
Finally we convert our arraylist into a Product array again.
First we make an array from out arraylist using its ToArray() method telling it that the type of stored items is Product (typeof(Product)) then we cast our array (that so far is an object array) to a product array using (Product[]);
So we've done two tasks at one line.We could write it like this:
<br />
object[] array=myArrayList.ToArray(typeof(myClass));<br />
myClass[] convertedArray=(myClass[])array;<br />

There are a lot of good books about C# and .Net programming but what I found really useful are MSDN and this site(Code Project) you can learn a lot of things about C# and programming here.
Wrox Programming C# is a good book.
There's another book that I like "Teach yourself object oriented programming in 21 days" It's written in java though.
Anyway I'm glad that you could solve your problem and If there's anything else just I will be glad if I can help.
Regards
AnswerRe: one to many class association Pin
Nader Elshehabi24-Aug-06 10:51
Nader Elshehabi24-Aug-06 10:51 
Questionusing Sission by c# Pin
mhattiyah24-Aug-06 4:46
mhattiyah24-Aug-06 4:46 
AnswerRe: using Sission by c# Pin
ToddHileHoffer24-Aug-06 5:10
ToddHileHoffer24-Aug-06 5:10 
Questioninconsistency in virtual dir Pin
Kunal P24-Aug-06 4:31
Kunal P24-Aug-06 4:31 
AnswerRe: inconsistency in virtual dir Pin
Ennis Ray Lynch, Jr.24-Aug-06 9:15
Ennis Ray Lynch, Jr.24-Aug-06 9:15 
GeneralRe: inconsistency in virtual dir Pin
Kunal P24-Aug-06 20:03
Kunal P24-Aug-06 20:03 
GeneralRe: inconsistency in virtual dir Pin
Guffa24-Aug-06 22:42
Guffa24-Aug-06 22:42 
QuestionDoh! Regular Expressions and C# Strings [modified] Pin
Brent Lamborn24-Aug-06 4:24
Brent Lamborn24-Aug-06 4:24 
AnswerRe: Doh! Regular Expressions and C# Strings Pin
Coding C#24-Aug-06 4:38
Coding C#24-Aug-06 4:38 
GeneralRe: Doh! Regular Expressions and C# Strings Pin
User 665824-Aug-06 5:31
User 665824-Aug-06 5:31 
AnswerRe: Doh! Regular Expressions and C# Strings Pin
coolestCoder24-Aug-06 4:42
coolestCoder24-Aug-06 4:42 
GeneralRe: Doh! Regular Expressions and C# Strings Pin
Brent Lamborn24-Aug-06 6:26
Brent Lamborn24-Aug-06 6:26 
GeneralRe: Doh! Regular Expressions and C# Strings [modified] Pin
coolestCoder24-Aug-06 19:52
coolestCoder24-Aug-06 19:52 
GeneralRe: Doh! Regular Expressions and C# Strings Pin
Coding C#24-Aug-06 20:19
Coding C#24-Aug-06 20:19 
GeneralRe: Doh! Regular Expressions and C# Strings Pin
Brent Lamborn25-Aug-06 4:17
Brent Lamborn25-Aug-06 4:17 
Questionrefreshing the printer folder Pin
AnnnS24-Aug-06 4:23
AnnnS24-Aug-06 4:23 
QuestionRecording Control [modified] Pin
Mohammad Hajjat24-Aug-06 4:08
Mohammad Hajjat24-Aug-06 4:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.