Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
AnswerRe: Background worker thread Pin
DaveyM6915-Nov-12 18:51
professionalDaveyM6915-Nov-12 18:51 
QuestionArray, Struct, Class??? I'm so confused.... Pin
KKW_acd15-Nov-12 6:29
KKW_acd15-Nov-12 6:29 
AnswerRe: Array, Struct, Class??? I'm so confused.... Pin
DaveyM6915-Nov-12 6:55
professionalDaveyM6915-Nov-12 6:55 
GeneralRe: Array, Struct, Class??? I'm so confused.... Pin
KKW_acd15-Nov-12 9:03
KKW_acd15-Nov-12 9:03 
AnswerRe: Array, Struct, Class??? I'm so confused.... Pin
DaveyM6915-Nov-12 19:02
professionalDaveyM6915-Nov-12 19:02 
GeneralRe: Array, Struct, Class??? I'm so confused.... Pin
Richard MacCutchan16-Nov-12 0:02
mveRichard MacCutchan16-Nov-12 0:02 
AnswerRe: Array, Struct, Class??? I'm so confused.... Pin
Richard MacCutchan15-Nov-12 7:06
mveRichard MacCutchan15-Nov-12 7:06 
AnswerRe: Array, Struct, Class??? I'm so confused.... Pin
BobJanova16-Nov-12 0:16
BobJanova16-Nov-12 0:16 
The immediate error is what's in the message.

However, I suspect you didn't mean to create a struct here. A struct in C# is a value type, so wherever it is passed to a method, a copy is taken, and the initial version is not modifiable. However, the array within the struct will be modifiable and the array in the outside version of the struct will be updated! A struct containing references to reference types, like an array, is usually not what you meant to do.

I think you are trying to recreate the C++

typedef struct {
 string FieldName;
 int FieldIndex;
} ItmAray;

typedef struct {
 ItmAray[128] ItemArray;
} DtLst;

DtLst[128] DataList;


But the arrays there are references: DtLst[100] is a reference to a DtLst, and passing it to a function will pass it by reference. In C# I think you want a class.

Also, fixed length arrays are generally not what you want in the modern world. I think what you actually want is

class Field {
 string Name;
 int Index;
}

class DataListItem {
 List<Field> Fields;
}

List<DataListItem> DataList;

QuestionWind Chill Automation with C# application Pin
omisheikh15-Nov-12 6:03
omisheikh15-Nov-12 6:03 
AnswerRe: Wind Chill Automation with C# application Pin
jschell15-Nov-12 8:12
jschell15-Nov-12 8:12 
GeneralRe: Wind Chill Automation with C# application Pin
omisheikh16-Nov-12 3:25
omisheikh16-Nov-12 3:25 
GeneralRe: Wind Chill Automation with C# application Pin
jschell17-Nov-12 5:40
jschell17-Nov-12 5:40 
GeneralRe: Wind Chill Automation with C# application Pin
omisheikh18-Nov-12 21:00
omisheikh18-Nov-12 21:00 
QuestionAccess mainform while subform is updating Pin
MAW3014-Nov-12 19:01
MAW3014-Nov-12 19:01 
AnswerRe: Access mainform while subform is updating Pin
Mycroft Holmes14-Nov-12 19:53
professionalMycroft Holmes14-Nov-12 19:53 
AnswerRe: Access mainform while subform is updating Pin
DaveyM6915-Nov-12 0:02
professionalDaveyM6915-Nov-12 0:02 
QuestionGet integer variable from datalist textbox for entry into SQL Pin
Member 959997514-Nov-12 10:10
Member 959997514-Nov-12 10:10 
AnswerRe: Get integer variable from datalist textbox for entry into SQL Pin
rajeshkasani0514-Nov-12 18:34
rajeshkasani0514-Nov-12 18:34 
GeneralRe: Get integer variable from datalist textbox for entry into SQL Pin
Member 959997514-Nov-12 22:50
Member 959997514-Nov-12 22:50 
GeneralRe: Get integer variable from datalist textbox for entry into SQL Pin
rajeshkasani0514-Nov-12 22:55
rajeshkasani0514-Nov-12 22:55 
GeneralRe: Get integer variable from datalist textbox for entry into SQL Pin
Member 959997515-Nov-12 2:25
Member 959997515-Nov-12 2:25 
GeneralRe: Get integer variable from datalist textbox for entry into SQL Pin
Richard MacCutchan15-Nov-12 3:21
mveRichard MacCutchan15-Nov-12 3:21 
QuestionC# clear out global cache Pin
dcof14-Nov-12 7:52
dcof14-Nov-12 7:52 
AnswerRe: C# clear out global cache Pin
jschell14-Nov-12 8:00
jschell14-Nov-12 8:00 
AnswerRe: C# clear out global cache Pin
Pete O'Hanlon14-Nov-12 11:00
mvePete O'Hanlon14-Nov-12 11:00 

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.