Click here to Skip to main content
15,892,298 members
Home / Discussions / C#
   

C#

 
GeneralRe: Do Lambda expressions smell? Pin
Member 444846031-Jul-11 10:59
Member 444846031-Jul-11 10:59 
AnswerIMHO Linq is a poor example of a good example Pin
Ennis Ray Lynch, Jr.29-Jul-11 10:25
Ennis Ray Lynch, Jr.29-Jul-11 10:25 
GeneralRe: IMHO Linq is a poor example of a good example Pin
Lutosław30-Jul-11 10:42
Lutosław30-Jul-11 10:42 
AnswerRe: Do Lambda expressions smell? Pin
PIEBALDconsult30-Jul-11 6:24
mvePIEBALDconsult30-Jul-11 6:24 
GeneralRe: Do Lambda expressions smell? Pin
jschell30-Jul-11 7:45
jschell30-Jul-11 7:45 
AnswerRe: Do Lambda expressions smell? Pin
jschell30-Jul-11 7:46
jschell30-Jul-11 7:46 
AnswerRe: Do Lambda expressions smell? Pin
BobJanova31-Jul-11 22:45
BobJanova31-Jul-11 22:45 
QuestionCreate array in class. Pin
Herboren29-Jul-11 9:49
Herboren29-Jul-11 9:49 
Im trying to figure out how to create an array in my class. What I have now is:

C#
namespace Computer_Specs
{
    class Computer
    {
        private string _Brand;
        private int _RAM;
        private string _cpuBrand;
        private float _cpuSpeed;
        private string _operatingSystem;

        //Array
        private string[] _clArray = new string[5];
        public string brand
        {
            get { return this._Brand; }
            set { this._Brand = value; }
        }
        public int ram
        {
            get { return this._RAM; }
            set { this._RAM = value; }
        }
        public string cpuBrand
        {
            get { return this._cpuBrand; }
            set { this._cpuBrand = value; }
        }
        public float cpuSpeed
        {
            get { return this._cpuSpeed; }
            set { this._cpuSpeed = value; }
        }
        public string os
        {
            get { return this._operatingSystem; }
            set { this._operatingSystem = value; }
        }
        //Array
        public string[] cla
        {
            get { return this._clArray; }
            set { this._clArray = value; }
        }
    }
}        //Array
        private string[] _clArray = new string[5];

        //Array
        public string[] cla
        {
            get { return this._clArray; }
            set { this._clArray = value; }
        }


But within my main form I don't know how to actually use the object to fill the array.

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Computer_Specs
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string nl = Environment.NewLine;
            Computer specs = new Computer();
            
            tbLog.Text = specs.brand = tbBrand.Text + nl;
            tbLog.Text = tbLog.Text + (specs.ram = int.Parse(tbRAM.Text)) + nl;
            tbLog.Text = tbLog.Text + (specs.cpuBrand = tbcpuBrand.Text) + nl;
            tbLog.Text = tbLog.Text + (specs.cpuSpeed = float.Parse(tbCPUSpeed.Text)) + nl;
            tbLog.Text = tbLog.Text + (specs.os = tbOS.Text) + nl;
            
            //Right here is where I am trying to fill my array.
            //...
        }
    }
}

AnswerRe: Create array in class. Pin
Member 448708329-Jul-11 10:06
Member 448708329-Jul-11 10:06 
GeneralRe: Create array in class. [modified] Pin
Herboren29-Jul-11 10:35
Herboren29-Jul-11 10:35 
GeneralRe: Create array in class. Pin
Keith Barrow30-Jul-11 0:28
professionalKeith Barrow30-Jul-11 0:28 
GeneralRe: Create array in class. Pin
BobJanova31-Jul-11 22:49
BobJanova31-Jul-11 22:49 
GeneralRe: Create array in class. Pin
Keith Barrow1-Aug-11 2:16
professionalKeith Barrow1-Aug-11 2:16 
QuestionSOAP versioning limits - loading legacy assembly Pin
lukeer29-Jul-11 3:04
lukeer29-Jul-11 3:04 
AnswerRe: SOAP versioning limits - loading legacy assembly Pin
jschell29-Jul-11 8:27
jschell29-Jul-11 8:27 
GeneralRe: SOAP versioning limits - loading legacy assembly Pin
lukeer31-Jul-11 22:54
lukeer31-Jul-11 22:54 
GeneralRe: SOAP versioning limits - loading legacy assembly Pin
jschell1-Aug-11 7:44
jschell1-Aug-11 7:44 
QuestionKnowing and tracing application memory consumtion and leaks? Pin
Chesnokov Yuriy28-Jul-11 21:24
professionalChesnokov Yuriy28-Jul-11 21:24 
AnswerRe: Knowing and tracing application memory consumtion and leaks? Pin
Dave Kreskowiak29-Jul-11 3:31
mveDave Kreskowiak29-Jul-11 3:31 
GeneralRe: Knowing and tracing application memory consumtion and leaks? Pin
Chesnokov Yuriy29-Jul-11 10:01
professionalChesnokov Yuriy29-Jul-11 10:01 
GeneralRe: Knowing and tracing application memory consumtion and leaks? Pin
Dave Kreskowiak29-Jul-11 11:01
mveDave Kreskowiak29-Jul-11 11:01 
QuestionASF Stream VU Meter Pin
jjdacl28-Jul-11 16:30
jjdacl28-Jul-11 16:30 
AnswerRe: ASF Stream VU Meter PinPopular
Keith Barrow28-Jul-11 23:26
professionalKeith Barrow28-Jul-11 23:26 
GeneralRe: ASF Stream VU Meter Pin
BillWoodruff30-Jul-11 2:28
professionalBillWoodruff30-Jul-11 2:28 
AnswerRe: ASF Stream VU Meter Pin
GuyThiebaut29-Jul-11 2:55
professionalGuyThiebaut29-Jul-11 2:55 

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.