Click here to Skip to main content
15,922,427 members
Home / Discussions / C#
   

C#

 
GeneralRe: log4net and nhibernate: app.config - conn string pwd in clear? Pin
devvvy5-Jan-09 14:49
devvvy5-Jan-09 14:49 
QuestionHow to declare an use a struct containing an array? Pin
scjsb5-Jan-09 5:13
scjsb5-Jan-09 5:13 
AnswerRe: How to declare an use a struct containing an array? Pin
Christian Graus5-Jan-09 5:17
protectorChristian Graus5-Jan-09 5:17 
AnswerRe: How to declare an use a struct containing an array? Pin
moon_stick5-Jan-09 5:25
moon_stick5-Jan-09 5:25 
GeneralRe: How to declare an use a struct containing an array? Pin
Not Active5-Jan-09 5:53
mentorNot Active5-Jan-09 5:53 
GeneralRe: How to declare an use a struct containing an array? Pin
moon_stick5-Jan-09 6:25
moon_stick5-Jan-09 6:25 
GeneralRe: How to declare an use a struct containing an array? Pin
Not Active5-Jan-09 6:52
mentorNot Active5-Jan-09 6:52 
AnswerRe: How to declare an use a struct containing an array? [modified] Pin
#realJSOP5-Jan-09 5:36
professional#realJSOP5-Jan-09 5:36 
Personally, I'd make your struct a class, and use a generic list instead of an array.

At that point you could do something like this:

public class ChangeRec
{
    private List<int> m_modes = new List<int>();

    public DateTime LastTimeStamp { get; set; }
    public int LastValue { get; set; }
    public List<int> Modes { get { return m_modes; } }

    public ChangeRec() {}
}


There is now no need to initialize the list beyond what's done in the class.

One other thing... I the variable "Last" refers to the last value added to the list. If that's the case, you can do this (uif you're using the code I posted above):

ChangeRec changeRec = new ChangeRec();

changeRec.Modes.Add(1);
changeRec.Modes.Add(2);
changeRec.Modes.Add(3);
changeRec.Modes.Add(4);

int lastValue = (int)(changeRec.Modes.Last());



"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


modified on Monday, January 5, 2009 11:42 AM

AnswerRe: How to declare an use a struct containing an array? Pin
Russell Jones5-Jan-09 5:42
Russell Jones5-Jan-09 5:42 
AnswerRe: How to declare an use a struct containing an array? Pin
Dragonfly_Lee5-Jan-09 17:39
Dragonfly_Lee5-Jan-09 17:39 
AnswerRe: How to declare an use a struct containing an array? Pin
Jon Rista6-Jan-09 10:41
Jon Rista6-Jan-09 10:41 
GeneralRe: How to declare an use a struct containing an array? Pin
scjsb7-Jan-09 1:45
scjsb7-Jan-09 1:45 
Questioncan you get rid of data members in a class after inheritance? Pin
bfis1081375-Jan-09 4:38
bfis1081375-Jan-09 4:38 
AnswerRe: can you get rid of data members in a class after inheritance? Pin
Christian Graus5-Jan-09 5:14
protectorChristian Graus5-Jan-09 5:14 
Questionhow to use XPath to parse the XML file? Pin
George_George5-Jan-09 3:18
George_George5-Jan-09 3:18 
AnswerRe: how to use XPath to parse the XML file? Pin
Le centriste5-Jan-09 3:22
Le centriste5-Jan-09 3:22 
GeneralRe: how to use XPath to parse the XML file? Pin
George_George5-Jan-09 3:34
George_George5-Jan-09 3:34 
GeneralRe: how to use XPath to parse the XML file? Pin
Le centriste5-Jan-09 3:55
Le centriste5-Jan-09 3:55 
GeneralRe: how to use XPath to parse the XML file? Pin
George_George5-Jan-09 22:33
George_George5-Jan-09 22:33 
GeneralRe: how to use XPath to parse the XML file? Pin
Abhijit Jana5-Jan-09 4:06
professionalAbhijit Jana5-Jan-09 4:06 
GeneralRe: how to use XPath to parse the XML file? Pin
George_George5-Jan-09 22:34
George_George5-Jan-09 22:34 
GeneralRe: how to use XPath to parse the XML file? Pin
led mike5-Jan-09 5:05
led mike5-Jan-09 5:05 
GeneralRe: how to use XPath to parse the XML file? Pin
George_George5-Jan-09 22:34
George_George5-Jan-09 22:34 
AnswerRe: how to use XPath to parse the XML file? Pin
Abhijit Jana5-Jan-09 4:03
professionalAbhijit Jana5-Jan-09 4:03 
GeneralRe: how to use XPath to parse the XML file? Pin
George_George5-Jan-09 22:35
George_George5-Jan-09 22:35 

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.