Weeired compile issue

  • Thread starter Thread starter Winista
  • Start date Start date
W

Winista

I have a property in my class like..

Int32 iVal;

public String Val
{
get{return iVal;}
set{this.iVal = value;}
}

Strange that compiler does not pick it up as error because of type mismatch.
 
|I have a property in my class like..
|
| Int32 iVal;
|
| public String Val
| {
| get{return iVal;}
| set{this.iVal = value;}
| }
|
| Strange that compiler does not pick it up as error because of type
mismatch.
|
|

Are you sure you are compiling this piece of code? The compiler should throw
an error message.

Willy.
 
Winista said:
I have a property in my class like..

Int32 iVal;

public String Val
{
get{return iVal;}
set{this.iVal = value;}
}

Strange that compiler does not pick it up as error because of type mismatch.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

The above certainly doesn't compile on my box...
 
The kicker is that if I create a small project to reproduce this issue the
compiler does pick up the issue. But in a large project, this problem shows
up. Unfortunately I can't send the whole project. I will try to narrow it
down to specific pattern and then post the code.

Thanks for asking for program for reproducing the issue.
 
Back
Top