if I don't exist OR ....
-
Found this C# beauty in 3 places in a particular class i'm updating.
if (this == null || ..... { // assigned values to self }
I'm guessing the person that wrote that was going to be checking a field to see if it was null but none of the assignment code within the {} indicates what that might have been. -
Found this C# beauty in 3 places in a particular class i'm updating.
if (this == null || ..... { // assigned values to self }
I'm guessing the person that wrote that was going to be checking a field to see if it was null but none of the assignment code within the {} indicates what that might have been. -
Found this C# beauty in 3 places in a particular class i'm updating.
if (this == null || ..... { // assigned values to self }
I'm guessing the person that wrote that was going to be checking a field to see if it was null but none of the assignment code within the {} indicates what that might have been. -
Found this C# beauty in 3 places in a particular class i'm updating.
if (this == null || ..... { // assigned values to self }
I'm guessing the person that wrote that was going to be checking a field to see if it was null but none of the assignment code within the {} indicates what that might have been. -
Found this C# beauty in 3 places in a particular class i'm updating.
if (this == null || ..... { // assigned values to self }
I'm guessing the person that wrote that was going to be checking a field to see if it was null but none of the assignment code within the {} indicates what that might have been.It's an AI piece of code - it's the equivalent to "I think therefore I am, you aren't me so you don't matter."
Deja View - the feeling that you've seen this post before.
-
It's an AI piece of code - it's the equivalent to "I think therefore I am, you aren't me so you don't matter."
Deja View - the feeling that you've seen this post before.
AI is much clearer in VB, as in
If (Me Is Nothing) Then ' I don't exist, so I can't think (straight? at all?) End If
:laugh: :laugh:
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Found this C# beauty in 3 places in a particular class i'm updating.
if (this == null || ..... { // assigned values to self }
I'm guessing the person that wrote that was going to be checking a field to see if it was null but none of the assignment code within the {} indicates what that might have been.OK, so you'd not want to assign a value to an object that was null, but it brings up an interesting discussion on the use of "if (this != null)". Take a look at this discussion on MSN[^] about this != null in C#.
cheers, Chris Maunder
CodeProject.com : C++ MVP
-
AI is much clearer in VB, as in
If (Me Is Nothing) Then ' I don't exist, so I can't think (straight? at all?) End If
:laugh: :laugh:
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
Luc Pattyn wrote:
Me Is Nothing
that is not philosophy, but an inferiority complex :D
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist -
Luc Pattyn wrote:
Me Is Nothing
that is not philosophy, but an inferiority complex :D
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighistpeterchen wrote:
inferiority complex
not being fluent in VB.NET does that to people; I'm just a C# guy. :-D
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Found this C# beauty in 3 places in a particular class i'm updating.
if (this == null || ..... { // assigned values to self }
I'm guessing the person that wrote that was going to be checking a field to see if it was null but none of the assignment code within the {} indicates what that might have been.if (this == null)
{
// I wasn't here; you never saw me
} -
Found this C# beauty in 3 places in a particular class i'm updating.
if (this == null || ..... { // assigned values to self }
I'm guessing the person that wrote that was going to be checking a field to see if it was null but none of the assignment code within the {} indicates what that might have been.if (this == null || ..... { // assigned values to self } You can get into the true part there, you just have to do a bit of IL hacking. Since instance methods are like static methods with a "this" param as the first arg in il. you can invoke such method and pass null to "this" Im not saying you should do this, but its possible :-) I happened to get that problem when I was doing the subclass proxies for NAspect (our AOP framework) It works as long as you don't access any member variables :-P
Blog: http://www.rogeralsing.com Projects: http://www.puzzleframework.com
-
peterchen wrote:
inferiority complex
not being fluent in VB.NET does that to people; I'm just a C# guy. :-D
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
Luc Pattyn wrote:
not being fluent in VB.NET does that to people;
I'm not fluent, and that doesn't make me feel inferior. Conclusion? I'm not people. Wow, that was easy ;) In case you missed it, I meant the language (not you) expresses its inferiority complex with "me is nothing"
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist