473,396 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

IsNothing

I cache a ton of stuff, and my ASP.NET application works great....but......

When I am stress testing it I'll get the "Object reference not set to an
instance of an object"
every once in a while...

It tends to happen when the cache is expired.....
I do a lot testing to make sure that it actually returns the object out of
cache...
I insure that it is a valid object, then when I try to use it I get that
error.

My question is this: When get something out of cache:

Return
CType(System.Web.HttpContext.Current.Cache.Get(CAF actory.Conts.CACHE_MANAGER
), CAManager)

I believe this returns a reference to the object, so in the instant that I
return the correct reference and I am about to use it, it expires....so the
object doesn't exist anymore?

Am I thinking about this correctly? Should I test for this all the time?

If not isnothing(object) then object.Function()

What kind of performance impact would this have?
Is the "IsNothing()" function expensive?

- Brian

Nov 21 '05 #1
2 2058
Brian,

The isNothing is only testing if there is a value in the reference from an
object.

I personaly find nicer

If Not object Is Nothing then

I hope this helps?

Cor
Nov 21 '05 #2
"Brian Linden" <br***@ineedadip.com> schrieb:
What kind of performance impact would this have?
Is the "IsNothing()" function expensive?


I assume it's more expensive than using 'If ... Is Nothing Then...'. Don't
worry about the performance, checking if a reference is a 'Nothing'
reference is very fast.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jim Heavey | last post by:
I am trying to transition from VB.Net - what is the equivalent if the IsNothing()? Thanks in advance for your assistance!!!!!!!!!
12
by: Steve Peterson | last post by:
Hi - just a quick question. I was wondering which is the better "VB.Net" way - to use IsNothing or the Is Nothing in an If..Then statement For example: If IsNothing(myObject) then 'blah...
4
by: tinman | last post by:
Hi.... There appears to be another way of checking if an object IsNothing in ..NET.....was wondering if this approach is better than the classic VB6 way of checking Is Nothing ? Example...
8
by: MattB | last post by:
Hello. I have a vb.net (asp.net) application that uses ado.net datasets. At one point, I need to check a text field in a DataTable to see if there's any text in it before performing text operations...
4
by: Dave Taylor | last post by:
This is really not very important but something that I'm just curious about...which is faster to execute or are they the same: (1) If IsNothing(_myVar) Then ... or (2) If _myVar Is Nothing...
2
by: Renilkumar | last post by:
Hello, I have successfully migrated asp.net application built in VS2003/1.1 to VS2005/2.0 in my local machine. It runs good without any errors. However If I copy the application into the shared...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.