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

C#

 
AnswerRe: Need help with my very first c# application Pin
MasttsaM13-Oct-10 22:43
MasttsaM13-Oct-10 22:43 
QuestionAbout creating Editable(fillable) PDF-forms Pin
sameermaske7-Oct-10 4:04
sameermaske7-Oct-10 4:04 
AnswerRe: About creating Editable(fillable) PDF-forms Pin
Ennis Ray Lynch, Jr.7-Oct-10 6:26
Ennis Ray Lynch, Jr.7-Oct-10 6:26 
QuestionParsing a text file. Pin
jenya77-Oct-10 3:21
jenya77-Oct-10 3:21 
AnswerMessage Closed Pin
7-Oct-10 3:41
stancrm7-Oct-10 3:41 
GeneralRe: Parsing a text file. Pin
jenya77-Oct-10 3:57
jenya77-Oct-10 3:57 
GeneralRe: Parsing a text file. Pin
#realJSOP7-Oct-10 23:41
mve#realJSOP7-Oct-10 23:41 
AnswerRe: Parsing a text file. Pin
PIEBALDconsult7-Oct-10 16:28
mvePIEBALDconsult7-Oct-10 16:28 
QuestionMicrosoft.Office.Interop.Excel BorderAround2 crash Pin
Blubbo7-Oct-10 2:58
Blubbo7-Oct-10 2:58 
AnswerRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Dave Kreskowiak7-Oct-10 3:44
mveDave Kreskowiak7-Oct-10 3:44 
GeneralRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Blubbo7-Oct-10 4:02
Blubbo7-Oct-10 4:02 
GeneralRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Dave Kreskowiak7-Oct-10 4:42
mveDave Kreskowiak7-Oct-10 4:42 
GeneralRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Blubbo7-Oct-10 4:49
Blubbo7-Oct-10 4:49 
GeneralRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Dave Kreskowiak7-Oct-10 6:04
mveDave Kreskowiak7-Oct-10 6:04 
GeneralRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Luc Pattyn7-Oct-10 6:29
sitebuilderLuc Pattyn7-Oct-10 6:29 
QuestionSave a file from ASP.NET down to database and upp again. Pin
anderslundsgard6-Oct-10 23:44
anderslundsgard6-Oct-10 23:44 
AnswerRe: Save a file from ASP.NET down to database and upp again. Pin
J4amieC7-Oct-10 0:50
J4amieC7-Oct-10 0:50 
Questionmake mouse disable, how that user could not be able to use it. Pin
Fred 346-Oct-10 23:36
Fred 346-Oct-10 23:36 
AnswerRe: make mouse disable, how that user could not be able to use it. Pin
Eddy Vluggen7-Oct-10 1:01
professionalEddy Vluggen7-Oct-10 1:01 
AnswerRe: make mouse disable, how that user could not be able to use it. Pin
Rhuros7-Oct-10 1:35
professionalRhuros7-Oct-10 1:35 
AnswerRe: make mouse disable, how that user could not be able to use it. Pin
S Houghtelin7-Oct-10 5:52
professionalS Houghtelin7-Oct-10 5:52 
GeneralRe: make mouse disable, how that user could not be able to use it. Pin
PIEBALDconsult9-Oct-10 4:27
mvePIEBALDconsult9-Oct-10 4:27 
GeneralRe: make mouse disable, how that user could not be able to use it. Pin
S Houghtelin12-Oct-10 3:09
professionalS Houghtelin12-Oct-10 3:09 
QuestionList inside a struct Pin
Islorvat6-Oct-10 22:45
Islorvat6-Oct-10 22:45 
AnswerRe: List inside a struct Pin
J4amieC6-Oct-10 22:57
J4amieC6-Oct-10 22:57 
You've not instantiated the List anywhere. This has nothing to do with it being inside a struct - the same would have happened if your list was inside a class.

You can fix this by first creating the List.

testStruct aTestStruct = new testStruct();
aTestStruct.sList = new List<string>();
aTestStruct.sList.Add("test");


However, a few pointers

0.1) Naming convention for C# would instruct that your property is called List instead of sList.
0.2) Be careful using structs, they have some hard to understand facets - if in doubt use a class.
0.3) Strictly speaking, a List should generally not be exposed by a public property. Consider whether the struct/class should instead expose just the interface, such as an Add method to add to an internal List.

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.