NativeMethods
-
Hello, I have a question I've been trying to answer and I just can't find anything. When I use an interop method, I know I must put it inside a
NativeMethods
class. I'm writing a little utility library for my company and I was wondering where should thatNativeMethods
class go: inside the class that uses it as a nested type, or only one globally for all classes that use any interop method in it? By the way, can anyone explain to me what's the difference betweenSafeNativeMethods
,UnsafeNativeMethods
, andNativeMethods
? I just don't understand what MSDN says. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-
Hello, I have a question I've been trying to answer and I just can't find anything. When I use an interop method, I know I must put it inside a
NativeMethods
class. I'm writing a little utility library for my company and I was wondering where should thatNativeMethods
class go: inside the class that uses it as a nested type, or only one globally for all classes that use any interop method in it? By the way, can anyone explain to me what's the difference betweenSafeNativeMethods
,UnsafeNativeMethods
, andNativeMethods
? I just don't understand what MSDN says. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
You can group nativemethods in different classes. for example, process related methods in NativeProcessMethods, GDI related methods in NativeGDIMethods. where to put these classes is a raltive issue dependent in your design. But I prefer to put all native methods classes in a class library to use it in another porject in the future to avoid rewriting the code. Hope this helps:) Hesham
-
You can group nativemethods in different classes. for example, process related methods in NativeProcessMethods, GDI related methods in NativeGDIMethods. where to put these classes is a raltive issue dependent in your design. But I prefer to put all native methods classes in a class library to use it in another porject in the future to avoid rewriting the code. Hope this helps:) Hesham
Interesting comments, thanks!! :) Yes, I think I'll move everything into a global class for easier reusability, with hopes that the library will grow. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005