Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
Generalbinding Pin
cristina_tudor12-May-05 11:02
cristina_tudor12-May-05 11:02 
Generalfoolish question , help! Pin
jinzhecheng12-May-05 9:16
jinzhecheng12-May-05 9:16 
GeneralRe: foolish question , help! Pin
Robert Rohde12-May-05 10:20
Robert Rohde12-May-05 10:20 
GeneralRe: foolish question , help! Pin
S. Senthil Kumar12-May-05 23:26
S. Senthil Kumar12-May-05 23:26 
GeneralRe: foolish question , help! Pin
leppie13-May-05 0:12
leppie13-May-05 0:12 
GeneralRe: foolish question , help! Pin
lgstef16-May-05 3:28
lgstef16-May-05 3:28 
GeneralRe: foolish question , help! Pin
leppie16-May-05 5:36
leppie16-May-05 5:36 
GeneralRe: foolish question , help! Pin
lgstef16-May-05 5:57
lgstef16-May-05 5:57 
not 'illegal'.. sentinel value.

...The point here is to check if the struct has been used or not....

Try this:
void SomeMethod()
{
Foo[] a = new Foo[2];
if (a[0].Equals(Foo.Empty)) // does a field by field comparision in valuetype
MessageBox.Show("a[0] = Foo.Empty");
else
MessageBox.Show("a[0] != Foo.Empty");

a[0].a = a[0].b = 1;

if (a[0].Equals(Foo.Empty))
MessageBox.Show("a[0] = Foo.Empty");
else
MessageBox.Show("a[0] != Foo.Empty");

a[0].a = a[0].b = 0;

if (a[0].Equals(Foo.Empty))
MessageBox.Show("a[0] = Foo.Empty");
else
MessageBox.Show("a[0] != Foo.Empty");
}
.......................
Output:
"a[0] = Foo.Empty"
"a[0] != Foo.Empty"
"a[0] = Foo.Empty" !!!! which means that this struct haven't been used before!

..but we used a[0] before...
GeneralRe: foolish question , help! Pin
leppie16-May-05 8:02
leppie16-May-05 8:02 
GeneralHTTP Listener Pin
Tridith12-May-05 8:34
Tridith12-May-05 8:34 
GeneralRe: HTTP Listener Pin
Stefan Prodan12-May-05 12:11
Stefan Prodan12-May-05 12:11 
GeneralRe: HTTP Listener Pin
Tridith16-May-05 5:06
Tridith16-May-05 5:06 
General2 problems Pin
x-trate12-May-05 7:55
x-trate12-May-05 7:55 
GeneralRe: 2 problems Pin
Luis Alonso Ramos12-May-05 8:37
Luis Alonso Ramos12-May-05 8:37 
QuestionHow to change MAC address? Pin
Stefan Prodan12-May-05 7:52
Stefan Prodan12-May-05 7:52 
AnswerRe: How to change MAC address? Pin
Michael A. Barnhart12-May-05 11:31
Michael A. Barnhart12-May-05 11:31 
GeneralRe: How to change MAC address? Pin
Stefan Prodan12-May-05 12:02
Stefan Prodan12-May-05 12:02 
GeneralRe: How to change MAC address? Pin
Dave Kreskowiak12-May-05 14:09
mveDave Kreskowiak12-May-05 14:09 
GeneralSharing statics across AppDomains Pin
S. Senthil Kumar12-May-05 7:46
S. Senthil Kumar12-May-05 7:46 
GeneralThread Stop Exception Pin
Adnan Siddiqi12-May-05 7:19
Adnan Siddiqi12-May-05 7:19 
GeneralRe: Thread Stop Exception Pin
Daniel Grunwald12-May-05 10:14
Daniel Grunwald12-May-05 10:14 
GeneralRe: Thread Stop Exception Pin
nyjetswin200512-May-05 12:17
nyjetswin200512-May-05 12:17 
GeneralAfterLabelEdit event for listview ctl Pin
poniatow12-May-05 5:51
poniatow12-May-05 5:51 
GeneralRe: AfterLabelEdit event for listview ctl Pin
Luis Alonso Ramos12-May-05 6:08
Luis Alonso Ramos12-May-05 6:08 
GeneralRe: AfterLabelEdit event for listview ctl Pin
poniatow12-May-05 8:18
poniatow12-May-05 8:18 

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.