473,486 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

using IsDate might cause performance problems?

Hi,

i see in reflector in inner implementation of the
Microsoft.VisualBasic.Information.IsDate function that looks like that:

public static bool IsDate(object Expression)
{
if (Expression != null)
{
if (Expression is DateTime)
{
return true;
}
if (Expression is string)
{
try
{
DateTime time1 = DateType.FromString((string)
Expression);
return true;
}
catch (Exception)
{
}
}
}
return false;
}

i understand that exceptions in general uses many resources so if i don't
want exceptions to occur in my code if not needed to i should avoid
exception if not muse happend.

so would you recomend using IsDate as a general check in my code??

TIA, z.
Nov 21 '05 #1
2 1499
"z. f." <zi**@info-scopeREMSPAM.co.il> schrieb:
i understand that exceptions in general uses many resources so if i don't
want exceptions to occur in my code if not needed to i should avoid
exception if not muse happend.

so would you recomend using IsDate as a general check in my code??


Yes. Even alternatives like 'Date.Parse'/'Date.ParseExact' will throw an
exception if the date string is in a format that is cannot be converted to a
'Date'.

--
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 #2
ZF,

In my opinion is there not much better, because than in my idea would
Microsoft implemented a better solution when it had been possible. Or you
should as some people do, limit the posibilities, what is than of course not
the same as IsDate.

Don't forget that a IsDate checks all posible string versions of a date in
the current culture of the system.

Just my thought,

Cor
Nov 21 '05 #3

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

Similar topics

22
2298
by: Bradley | last post by:
Has anyone else noticed this problem? I converted the back-end to A2000 and the performance problem was fixed. We supply a 97 and 2000 version of our software so we kept the backend in A97 to make...
19
4064
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
0
1508
by: vonclausowitz | last post by:
Hi All, I use IsDate() to check a field in Outlook tasks to see if it contains a real date. If IsDate(Task.role) then ... else ... endif
2
3407
by: John | last post by:
Hi all, How do I use the isDate function? The reason I ask this is because the function returns a false for a date "13/09/2004" which is correct in "dd/MM/yyyy" format. Is there another...
3
1541
by: Andy Holliman | last post by:
Why does IsDate("01 02 03 12 2003") return true and CDate("01 02 03 12 2003") return "1 12 2003" ? Thanks Andy
2
4451
by: Oenone | last post by:
I'm having a couple of problems with the IsDate function in VB.net (.net framework v1.1). Having searched the web and usenet for others having the same problem, I've seen several posts from people...
0
3988
by: David | last post by:
- Are there any peculiarities with using curs.executemany(...) vs. multiple How many times are you calling execute vs a single executemany? The python call overhead will add up for thousands of...
53
2572
by: None | last post by:
Hi, I am a game developer, sometimes "indy" and sometimes for a small-sized company. I can't speak for all game developers, but everywhere I've ever seen people working on games, execution...
25
11609
smithj14
by: smithj14 | last post by:
I have a form that has an option group (fraReports) which holds a list of reports to print. This part works fine. I select a report name and click print and that report opens. Now I want to add a...
0
7099
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
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
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
7175
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...
1
6842
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
7319
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4864
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.