GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 426 of 431    Print  
Variable Declaration and Assignment
What is difference between these two statement? if variable is declared and assign value in following two ways

String sValue = (String)GridView1.DataKeys[GridView1.SelectedIndex].Value;
String sValue = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString();



  
Total Answers and Comments: 1 Last Update: June 11, 2008     Asked by: ranbiragarwal 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 11, 2008 06:49:49   #1  
infoeweb Member Since: June 2008   Contribution: 3    

RE: Variable Declaration and Assignment

.tostring method doesot handle null value where as other does..

vijay

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    

 Related Questions

The difference is that static read-only can be modified by the containing class, but const can never be modified and must be initialized to a compile time constant. To expand on the static read-only case 
Latest Answer : Constant : The constants are the one whose value remain same at all the time.it will be used if u want to define something at compile time.Read only....if you don't know value at compile time but u can find that at runtime that time u can use ...

The word checked is a keyword in C#.  
Latest Answer : Reason is checked is a keyword in C#,but if u want to keyword as an identifier use @ with it.e.g int @checked=3;This works with all the keywords,but it is recommended to avoid it. ...

If you leave off the return type on a method declaration, the compiler thinks you are trying to declare a constructor. So if you are trying to declare a method that returns nothing, use void. The following 
Latest Answer : If your method does not have any return type then mention void before that method or return 0 ...

I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it?
You should declare the variable as an int, but when you pass it in you must specify it as 'out', like the following: int i;foo(out i);where foo is declared as follows: [return-type] foo(out int 

If you try to instantiate the class inside the try, it'll be out of scope when you try to access it from the catch block. A way to get around this is to do the following: Connection conn = null; try 
Latest Answer : ans:Answer: If you try to instantiate the class inside the try, it'll be out of scope when you try to access it from the catch block. A way to get around this is to do the following: Connection conn = null; try {conn = new Connection();conn.Open();}finally{ ...

No. C# does, however, support the concept of an indexer from language spec. An indexer is a member that enables an object to be indexed in the same way as an array. Whereas properties enable field-like 
Latest Answer : Ans:No ...

Value, and its datatype depends on whatever variable we are changing.  
Latest Answer : Ans:value is  implicit name of the parameter that gets passed into the class set method. ...

Classes in the same namespace.  
Latest Answer : Namespaces is not correct - The protected modifier allows the field to be accessed only by the inherting class and the base class. If you were to put the modifier 'protected internal' then the field can be accessed by inheriting classes and also by classes ...

Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.  
Latest Answer : Yes. Go to immediate window in VS.net and use >eval var = newvalue ...

Value, and its datatype depends on whatever variable we're changing. 
Latest Answer : Ans: Value :parameter gets passed into the class' set method ...


 Sponsored Links

 
Related Articles

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(“%d”,x); z= sample() } sample() { printf(“Testing program”); } Output is   &n
 

What happens when a variable is not declared in function definition?

Generally in C program the function definition and calling takes the form as given below: main() { int x,y,z; z=sample(x,y); printf(“%d”,z); } sample(x1,y1) int x1,y1; { int z1; z1= x1 - y1; return(z1); } Here what happens is the values x, y gets passed to x1,y1
 

Assign values during declaration

How to assign values during declaration of variables Declaring variables tells the compiler the data type the variable is assigned and no storage area is allocated during this stage. It is possible to assign values during declaration itself. For example, consider the following program: main() {
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

Variable, Constants and Data types in C++

Variable Constants and Data types in C In this C tutorial you will learn about variable constants and data types in C rules for defining variable name short int int long int float double long double char bool declaring variables and constants mosgoogle Variables A variable is the storage location in
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

HR Interview - How To Prepare For Your HR Interview

How To Prepare For Your HR Interview Before you begin thinking about how you are going to dress for the interview it is important to do your research first You should learn everything you can about the company you wish to work for When you have detailed information about your employer you will conve
 

Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape