wrote in message=20
> news:OfntlMATIHA.6036@TK2MSFTNGP03.phx.gbl...
>> Hi All,
>>
>> Need to check if the propery of an object exits.
>>
>> oMyObject.Message
>>
>> In some cases the Message property may not exists. I know the =
GetType()=20
>> can do it.
>> How would you check it?
>>
>> Thanks,
>>
>> Joe
>>=20
>
------=_NextPart_000_0032_01C84D50.AC4562D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
And when you performed an
Type myType =3D =
myException.GetType();
PropertyInfo[] properties =
myType.GetProperties();
what did you get?
--
Robbe Morris [Microsoft MVP - Visual C#]
AdvancedXL =
Server,=20
Designer, and Data Analyzer
Convert cell ranges in Excel to rule =
driven web=20
surveys
href=3D"http://www.equalssolved.com/default.aspx">http://www .equalssolved=
..com/default.aspx
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"JoeP" <
href=3D"mailto:NoSpam@Hotmail.com">NoSpam@Hotmail.com>=20
wrote in message
=
href=3D"news:O8Pjv7ATIHA.4656@TK2MSFTNGP03.phx.gbl">news:O8P jv7ATIHA.4656=
@TK2MSFTNGP03.phx.gbl...
Hi Robbin,
Thanks for your reply.
Here is the situation I have 2 =
objects such as:=20
Execption or SMTPExecption
The SMTPExecption has the property =
StatusCode=20
while the other does not.
I pass the the object into an error =
handle=20
method where I log the properties into a text file.
Looking at the Watch window it=20
seems that the Execption does not have System.Reflection=20
etc...
Regards,
Joe
"Robbe Morris - [MVP] C#" =
<
href=3D"mailto:info@eggheadcafe.com">
size=3D2>info@eggheadcafe.com
size=3D2>> wrote in=20
message
href=3D"news:eEpD5nATIHA.4880@TK2MSFTNGP03.phx.gbl">
face=3DArial =
size=3D2>news:eEpD5nATIHA.4880@TK2MSFTNGP03.phx.gbl
face=3DArial size=3D2>...
> =
System.Reflection and iterate through the PropertyInfo[].
> =
> The=20
Type of the object has a .GetProperties method.
>
> -- =
>=20
Robbe Morris [Microsoft MVP - Visual C#]
> .NET Setup Deployment =
- MSI,=20
Cassini, SQL Server, NTFS
>
=
href=3D"http://www.eggheadcafe.com/tutorials/aspnet/2a5222d8 -3d69-4f1c-b5=
ab-35ca33da0f65/net-setup-deployment--m.aspx">
face=3DArial=20
=
size=3D2>http://www.eggheadcafe.com/tutorials/aspnet/2a5222d 8-3d69-4f1c-b=
5ab-35ca33da0f65/net-setup-deployment--m.aspx
face=3DArial size=3D2>>
>
>
> "JoeP" =
<
href=3D"mailto:NoSpam@Hotmail.com">
size=3D2>NoSpam@Hotmail.com> =
wrote in=20
message
>
href=3D"news:OfntlMATIHA.6036@TK2MSFTNGP03.phx.gbl">
size=3D2>news:OfntlMATIHA.6036@TK2MSFTNGP03.phx.gbl
face=3DArial=20
size=3D2>...
>> Hi All,
>>
>> Need to check =
if the=20
propery of an object exits.
>>
>>=20
oMyObject.Message
>>
>> In some cases the Message =
property=20
may not exists. I know the GetType()
>> can do =
it.
>> How=20
would you check it?
>>
>> =
Thanks,
>>
>>=20
Joe
>>
>
------=_NextPart_000_0032_01C84D50.AC4562D0--