471,317 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

Weeired compile issue

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.
Jan 13 '06 #1
4 1081

"Winista" <na*********@hotmail.com> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...
|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.
Jan 13 '06 #2
Winista <na*********@hotmail.com> wrote:
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...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 13 '06 #3
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.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Winista <na*********@hotmail.com> wrote:
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...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Jan 16 '06 #4
"Winista" <na*********@hotmail.com> wrote in message
news:#R**************@TK2MSFTNGP14.phx.gbl...
Thanks for asking for program for reproducing the issue.


Why do you think we do it? Half the time, the original poster finds the
error right then.

--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Jan 16 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Rick Blythin | last post: by
2 posts views Thread by Brian | last post: by
2 posts views Thread by Dav Tan | last post: by
8 posts views Thread by farseer | last post: by
8 posts views Thread by Mark | last post: by
1 post views Thread by jeet232 | last post: by
6 posts views Thread by Ed Leafe | last post: by
1 post views Thread by sevak316 | last post: by
3 posts views Thread by Hill | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.