Re: [ADVANCED-DOTNET] Casting

2008-02-11 Thread Mark Hurd
On 12/02/2008, Niblett, Alex <[EMAIL PROTECTED]> wrote: > We have an old guidelines note to use IsAssignableFrom() followed by a > hard cast as opposed to using the 'as' keyword followed by a check for > null, but there is no explanation for why this approach should be used. > There are also no com

Re: [ADVANCED-DOTNET] Casting

2008-02-11 Thread Greg Young
Its because "Is" works similar to Type.IsInstanceOfType which is very different from whether or not the type can be converted to the type. Think explicit conversions, the type is not the interface but can be converted to it. It makes no difference between 1.1 and 3.5 the same issue applies. Cheer

[ADVANCED-DOTNET] Casting

2008-02-11 Thread Niblett, Alex
We have an old guidelines note to use IsAssignableFrom() followed by a hard cast as opposed to using the 'as' keyword followed by a check for null, but there is no explanation for why this approach should be used. There are also no comments on the 'is' keyword approach to casting. Can somebody ple

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-27 Thread Paul Stevens
Thanks Eric, I'll Keep t hat in mind -Original Message- From: Eric Gunnerson [mailto:[EMAIL PROTECTED] Sent: 26 January 2004 08:15 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Casting Problem Paul, I'm not sure I recommended this before or not, but running the fuslog

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-26 Thread Eric Gunnerson
lf Of Paul Stevens Sent: Sunday, January 25, 2004 11:54 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Casting Problem I'm using Assembly.LoadFrom as the assemblies are "Add-Ins" that reside on a shared folder where they are used by both the front end and a back end component, the

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-26 Thread Paul Stevens
r, problem solved -Original Message- From: Heath Ryan [mailto:[EMAIL PROTECTED] Sent: 24 January 2004 06:49 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Casting Problem yep, My mistake, I meant LoadFrom. // Ryan - The information included in th

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-26 Thread Paul Stevens
in the immediate window but not anywhere else, obviously the .NET runtime has no problem with the cast, why should C# have a problem? -Original Message- From: Heath Ryan [mailto:[EMAIL PROTECTED] Sent: 24 January 2004 06:49 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Casting Problem

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-26 Thread Paul Stevens
ppens if all of the files are placed into a single folder, however that is not a perfect solution -Original Message- From: Eric Gunnerson [mailto:[EMAIL PROTECTED] Sent: 23 January 2004 08:23 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Casting Problem Assembly.Load should gi

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-26 Thread Paul Stevens
Thanks that might be part of it, as I am using assembly.load -Original Message- From: Heath Ryan [mailto:[EMAIL PROTECTED] Sent: 23 January 2004 06:30 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Casting Problem Hi Paul, Just a wild guess, Are you using Assembly.Load ? And

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-24 Thread Heath Ryan
yep, My mistake, I meant LoadFrom. // Ryan - The information included in this message is personal and/or confidential and intended exclusively for the addressees as stated. This message and/or the accompanying documents may contain confidential information an

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-23 Thread Eric Gunnerson
that you aren't compiling it separately into different assemblies. -Original Message- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Heath Ryan Sent: Friday, January 23, 2004 8:30 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Casti

Re: [ADVANCED-DOTNET] Casting Problem

2004-01-23 Thread Heath Ryan
implicitly by the CLR. HTH // Ryan -Original Message- From: Paul Stevens To: [EMAIL PROTECTED] Sent: 1/23/2004 1:03 PM Subject: [ADVANCED-DOTNET] Casting Problem I've got a very weird problem, Basically I have the following setup, 1. a Custom attribute class 2. a DLL that use

[ADVANCED-DOTNET] Casting Problem

2004-01-23 Thread Paul Stevens
I've got a very weird problem, Basically I have the following setup, 1. a Custom attribute class 2. a DLL that uses the custom attribute 3. a reader that checks a DLL for the custom attributes class System.Attribute.IsDefined(t,typeof(Multichoice.Attributes.RuntimeConfig)) 4.

Re: [ADVANCED-DOTNET] Casting

2002-09-19 Thread Mike Woodring
p.com/devresources - Original Message - From: "Mark Bugeja" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 18, 2002 6:32 PM Subject: Re: [ADVANCED-DOTNET] Casting > Hi Pierre, > > There are a couple of methods you can use depending on what

Re: [ADVANCED-DOTNET] Casting

2002-09-18 Thread Mark Bugeja
AM > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] Casting > > > Hi, > to transform a structure to array of byte[] I am using the following > procedure: > > public static unsafe byte[] StructToByte(MySimpleStruct > simpleStruct) { > byte[] arr = new byte[ > Syste

[ADVANCED-DOTNET] Casting

2002-09-18 Thread Pierre Greborio
Hi, to transform a structure to array of byte[] I am using the following procedure: public static unsafe byte[] StructToByte(MySimpleStruct simpleStruct) { byte[] arr = new byte[ System.Runtime.InteropServices.Marshal.SizeOf(simpleStruct) ]; fixed( byte* parr = arr ) { *((MySimpleStruct