|
||
|
|
#1 (permalink) |
|
Forum Expert
|
Having a background in ANSI C, I'm trying to figure out how to do something like this:
struct myStruct { int value1 char *string } theStruct; theStruct arrayOfStructs[]; How would I do something similiar in C#? If that even makes sense. Basically want an array of fields.
__________________
|
|
|
|
|
|
#2 (permalink) |
|
Forum Expert
Join Date: Nov 2005
Location: San Diego, CA
Posts: 1,824
|
Plenty of examples on the net, or even in the UO code. Just get a good global search tool and look for "struct" across the code base. With UO handy, some basic C# docs on the net, as well as the SDK docs here...
http://msdn2.microsoft.com/en-us/library/ms229335.aspx ... I was able to learn C# with little assistance. To answer your question: http://www.c-sharpcorner.com/Language/StructuresInCSRVS.asp http://www.c-sharpcorner.com/Code/2002/July/WorkingWithArrays.asp C// p.s. It's bad practice to use structs (use objects if you don't know why you're using a struct) without a good reason; a discussion of when to use them is here: http://www.codeproject.com/csharp/structs_in_csharp.asp Last edited by Courageous; 09-12-2006 at 06:42 PM. |
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
Join Date: Jul 2005
Location: Istanbul/Turkey
Age: 27
Posts: 425
|
here is another advanced article that discusses how to use structs efficiently.
__________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|