Click here to Skip to main content
16,005,125 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionInvalid File name error Pin
mkdas7028-Apr-06 21:12
mkdas7028-Apr-06 21:12 
QuestionDataGrid Pin
Uma Kameswari28-Apr-06 19:12
Uma Kameswari28-Apr-06 19:12 
AnswerRe: DataGrid Pin
Nagraj Naik28-Apr-06 22:15
Nagraj Naik28-Apr-06 22:15 
AnswerRe: DataGrid Pin
Praveen_S29-Apr-06 0:39
Praveen_S29-Apr-06 0:39 
AnswerRe: DataGrid Pin
DineshSharma1-May-06 0:39
DineshSharma1-May-06 0:39 
GeneralRe: DataGrid Pin
raghuvarma2-May-06 0:38
raghuvarma2-May-06 0:38 
Questioncomapring condition in if Pin
yogsworld28-Apr-06 19:08
yogsworld28-Apr-06 19:08 
AnswerRe: comapring condition in if Pin
Colin Angus Mackay28-Apr-06 21:38
Colin Angus Mackay28-Apr-06 21:38 
yogsworld wrote:
is both are same ?????????


Yes, the are both the same.

The reason you might see some people using the first varient is that in some languages (e.g. C, C++), if you made a mistake and typed
if (variableName = null)
by accident the compiler would accept it. (Note the single equal of assignment). By putting the constant on the left hand side of the operator the compiler would reject the assignment and the developer would realise they missed the extra equals sign.

In .NET, the langage specififcation states that the result of an if statement must be a boolean so the compiler would reject an assignment in an if statement. It will give the error message
Cannot implicitly convert type 'object' to 'bool'.
If someVariable was a boolean the error message you'd get is
Cannot convert null to 'bool' because it is a value type
However, there is one scenario where the compiler will accept an assignment in an if statement. That is, if the assignment evalulates to a boolean. e.g.
bool someVariable;
if (someVariable = false) {}
The compiler will compile this, but issue a warning instead
Assignment in conditional expression is always constant; did you mean to use == instead of = ?


Does this help?


"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)

My: Website | Blog
GeneralRe: comapring condition in if Pin
yogsworld29-Apr-06 0:05
yogsworld29-Apr-06 0:05 
GeneralRe: comapring condition in if Pin
Colin Angus Mackay29-Apr-06 0:29
Colin Angus Mackay29-Apr-06 0:29 
QuestionMemory leaks Pin
karthiBalu28-Apr-06 18:35
karthiBalu28-Apr-06 18:35 
AnswerRe: Memory leaks Pin
Colin Angus Mackay28-Apr-06 21:26
Colin Angus Mackay28-Apr-06 21:26 
QuestionHelp Trying Connect to SQL Pin
ALQallaf28-Apr-06 16:16
ALQallaf28-Apr-06 16:16 
AnswerRe: Help Trying Connect to SQL Pin
isroavi28-Apr-06 17:24
isroavi28-Apr-06 17:24 
GeneralRe: Help Trying Connect to SQL Pin
ALQallaf29-Apr-06 4:24
ALQallaf29-Apr-06 4:24 
GeneralRe: Help Trying Connect to SQL Pin
Colin Angus Mackay29-Apr-06 4:50
Colin Angus Mackay29-Apr-06 4:50 
AnswerRe: Help Trying Connect to SQL Pin
Colin Angus Mackay28-Apr-06 21:24
Colin Angus Mackay28-Apr-06 21:24 
GeneralRe: Help Trying Connect to SQL Pin
ALQallaf29-Apr-06 4:23
ALQallaf29-Apr-06 4:23 
GeneralRe: Help Trying Connect to SQL Pin
Colin Angus Mackay29-Apr-06 5:03
Colin Angus Mackay29-Apr-06 5:03 
AnswerRe: Help Trying Connect to SQL Pin
Kanjinghat4-May-06 3:29
Kanjinghat4-May-06 3:29 
AnswerRe: Help Trying Connect to SQL Pin
ALQallaf4-May-06 7:16
ALQallaf4-May-06 7:16 
QuestionLoading selected value from binding Pin
moazzamahmed28-Apr-06 13:19
moazzamahmed28-Apr-06 13:19 
AnswerRe: Loading selected value from binding Pin
minhpc_bk30-Apr-06 0:47
minhpc_bk30-Apr-06 0:47 
QuestionCrystal Report Parameter Passing Error Pin
AVA 7928-Apr-06 11:07
AVA 7928-Apr-06 11:07 
QuestionWebService & WSE 3.0 Pin
hung_ngole28-Apr-06 8:59
hung_ngole28-Apr-06 8:59 

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.