List Info

Thread: Casting to a type stored in a configuration file




Casting to a type stored in a configuration file
user name
2006-06-30 15:01:28
Hi all
We are testing different type of exception to create our
handling policy
and we run into the following problem.
While testing we want to throw different types of
exceptions, but would
like to have these types stored in the web.config, to avoid
compiling on
each test.

The code should look somehow like this:


    Dim myType As Object
    myType =
ConfigurationSettings.AppSettings("TestException"
;).GetType
    Dim temp As System.Type
    temp = myType.GetType()
    Dim exc As New Exception("Testing " &
mytype.ToString)
    exc = CType(exc, temp)
    Throw exc


With the only problem that this line exc = CType(exc, temp)
complains
that temp is not defined.

Is there any workaround?
Thanks in advance, 
Lizet

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )