Click here to Skip to main content
15,887,083 members
Home / Discussions / C#
   

C#

 
GeneralRe: event in c# Pin
tommmyyy1237-Mar-12 7:04
tommmyyy1237-Mar-12 7:04 
QuestionPlease See this Pin
Mohammed Owais7-Mar-12 3:20
professionalMohammed Owais7-Mar-12 3:20 
AnswerRe: Please See this Pin
BobJanova7-Mar-12 3:39
BobJanova7-Mar-12 3:39 
AnswerRe: Please See this Pin
Dave Kreskowiak7-Mar-12 3:43
mveDave Kreskowiak7-Mar-12 3:43 
Questionc# Pin
Member 87080197-Mar-12 2:15
Member 87080197-Mar-12 2:15 
AnswerRe: c# Pin
V.7-Mar-12 2:25
professionalV.7-Mar-12 2:25 
AnswerRe: c# Pin
PIEBALDconsult7-Mar-12 2:28
mvePIEBALDconsult7-Mar-12 2:28 
AnswerRe: c# PinPopular
OriginalGriff7-Mar-12 2:52
mveOriginalGriff7-Mar-12 2:52 
This has a big smell of homework about it, so I won't give you code!

Create a class (called Product) which has public properties Id, Description and Count
The first two properties may not require a public set method, just a get so you should make these private or protected, but the final one will require both as public. You could use a backing field, or allow it to be automatic.
It would be a good idea to provide a constructor which takes three parameters and sets the appropriate properties.

You can then create an array of the class which has sufficient elements or (preferably) a List which meaans that you do not have to worry about the number of elements at any point.

To declare an array of any class:
C#
MyClass[] myArrayOfClass = new MyClass[2000];

To declare it as a List:
C#
List<MyClass> myListOfClass = new List<MyClass>();

Neither of these allocate any actual instances of the class itself - just the structures that will store them.
In both cases, you will have to allocate each instance with the new keyword, and add it into the appropriate structure.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

GeneralRe: c# Pin
V.7-Mar-12 3:48
professionalV.7-Mar-12 3:48 
GeneralRe: c# PinPopular
OriginalGriff7-Mar-12 4:30
mveOriginalGriff7-Mar-12 4:30 
GeneralRe: c# Pin
V.7-Mar-12 5:16
professionalV.7-Mar-12 5:16 
GeneralRe: c# Pin
PIEBALDconsult7-Mar-12 4:32
mvePIEBALDconsult7-Mar-12 4:32 
AnswerRe: c# Pin
GParkings7-Mar-12 6:17
GParkings7-Mar-12 6:17 
AnswerRe: c# Pin
Abhinav S7-Mar-12 21:04
Abhinav S7-Mar-12 21:04 
QuestionTest If Out Parameter has been assigned Pin
MarkyBoy7687-Mar-12 2:13
MarkyBoy7687-Mar-12 2:13 
AnswerRe: Test If Out Parameter has been assigned Pin
PIEBALDconsult7-Mar-12 2:33
mvePIEBALDconsult7-Mar-12 2:33 
AnswerRe: Test If Out Parameter has been assigned Pin
BobJanova7-Mar-12 3:38
BobJanova7-Mar-12 3:38 
AnswerRe: Test If Out Parameter has been assigned Pin
Comfizzy7-Mar-12 3:40
Comfizzy7-Mar-12 3:40 
GeneralRe: Test If Out Parameter has been assigned Pin
MarkyBoy7687-Mar-12 4:43
MarkyBoy7687-Mar-12 4:43 
QuestionRunning wsDualHttpBinding on IIS Pin
nitin_ion6-Mar-12 22:21
nitin_ion6-Mar-12 22:21 
QuestionTrackBar control Pin
Saqib_ali_rana6-Mar-12 19:23
Saqib_ali_rana6-Mar-12 19:23 
AnswerRe: TrackBar control Pin
Abhinav S6-Mar-12 19:26
Abhinav S6-Mar-12 19:26 
AnswerRe: TrackBar control Pin
lukeer6-Mar-12 21:06
lukeer6-Mar-12 21:06 
Questionmsbuild success/failure condition c# Pin
canakcan6-Mar-12 5:00
canakcan6-Mar-12 5:00 
AnswerRe: msbuild success/failure condition c# Pin
canakcan6-Mar-12 5:03
canakcan6-Mar-12 5:03 

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.