Can we use a static function with a non-static variable?



Can we use a static function with a non-static variable?..

Answer / Desh Deepak Srivastava

In C#, which is commonly used in ASP.NET, you cannot directly access or modify a non-static member (like a field) from a static method because it does not have access to the instance of the class. However, you can pass an instance of the object as a parameter to the static function and use that instance's non-static members.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Can we have 2 web config files?

1 Answers  


Where is session data stored in asp net?

1 Answers  


What will happen if the server confugration file and the application confugration file have different values for sassion state ASP.NET?

1 Answers   HCL,


what is a virtual class?

1 Answers   Patni,


What are directives in asp.net?

1 Answers  


Define secured sockets layer.

1 Answers  


can u debug application programatically? if yes how?

0 Answers   FactorH,


What is asp.net futures?

1 Answers  


what is diffrent between asp & asp.net

2 Answers  


What are the type of session in Asp.Net

3 Answers  


when i want to use asp.net configuration for creat users and roles i recived this message: There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. The following message may help in diagnosing the problem: Unable to connect to SQL Server database. when i clicked the choose data source button that give me another message that is this: Use this page to configure how Web site management data such as membership is stored. You can use a single provider for all the management data for your site or you can specify a different provider for each feature. Your application is currently configured to use the provider: AspNetSqlProvider Select a single provider for all site management data Select a different provider for each feature (advanced) ------------------------- and this message was reapeted in other choose again. please help me if u know why i gave that message so i wont can creat my users and roles

0 Answers  


I have one .Net application and i have two databases which is in SQL server2000 and one more database in ORACLE? how can i access the database from different Databases?

3 Answers   eXensys,


Categories