473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

pb on cast from object to customtype

hi,

i'd like to do a "cast", who seem to be very complicated in .NET. in C
standard it's so easy...

i explain :
i have made an app based on plugin architecture in VB.NET. all work
fine..

but I want to avoid to the maximum to modify the interface at each new
plugin feature request from main app, i defined a function like this :

Public Function Host_GetObject(ByVal FonctionName As String,
Optional ByVal Parameters() As Object = Nothing) As Object() Implements
ENPI.Interfaces.IHost.Host_GetObject

this function get 1 parameter to tell witch "function" to do and 1
array of object (defined by the function) to optionals parameters of
this function.
this function return an array of object (content defined by the
"function" entry parameter)

i put this function in my interface between the main app and plugin. no
pb at this point.
if i use it with framework types, i get no problems.

But now, i want to return (in the array of object) a simple data
structure (no class !) like this :

Private Structure StrPIsName
Friend PIName As String
Friend PIAssyName As String
End Structure

the main app can make the array of object from array of StrPIsName.
good.
in the plugin, i get the array of object. good too.. but each object is
typed with mainapp.StrPIsName all this is normal.

but for me, for raisons i tell before, i don't want to put the
structure in the interface. (to avoid to recompil all plugin if i add
or change the structure to the interface..)

then, since my plugin does not have the reference to mainapp.StrPIsName
but to it's own StrPIsName, the cast can't be made.

do you understand what i mean ?

the end goal is to be able to make some enhancement or changes in the
main app and somme plugin or new plugins needs without the need to
recompil all other plugins.

i don't want to have many auxilliary DLL to get many interfaces between
main app and plugins too.

in fact, i want to do something (perhaps not good in .NET) like in
standard C :

toto = (mycast) tata;

HELPPP !!
Sep 17 '06 #1
2 1280
Eric bouxirot <ri****@rickou.netwrote:

<snip>
i don't want to have many auxilliary DLL to get many interfaces between
main app and plugins too.
You don't need to have many extra DLLs - just one which contains all
the types which need to be common between the main application and the
plugins. You can, in fact, have those types in just the executable
itself and reference that from the plugin, although that's slightly
messy in .NET 2003. What you mustn't do is have one copy of the type in
the executable and another in the plugin.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 18 '06 #2
Eric bouxirot <ri****@rickou.netwrote:
>
<snip>
>i don't want to have many auxilliary DLL to get many interfaces between
main app and plugins too.

You don't need to have many extra DLLs - just one which contains all
the types which need to be common between the main application and the
plugins. You can, in fact, have those types in just the executable
itself and reference that from the plugin, although that's slightly
messy in .NET 2003. What you mustn't do is have one copy of the type in
the executable and another in the plugin.
ok, i have add the structure to the interface.... it work even if i use
an old plugin compiled with reference to older dll...
hum...i don't like this...
Sep 18 '06 #3

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

Similar topics

0
by: Daylor | last post by:
first of all , PLEASE,say somthing..about my post. any reply will be nice to read. i have vb.app , with 2 appdomains. (now, in the next section , ill write "appdomain create" ,means a code in...
4
by: Richard Lee | last post by:
Hi, I have a question when I do a data type cast. the common way when we do a cast, is we know the type we want to cast to, i.e. we want to cast object to string, object xyz = "question";...
2
by: Dave Leach | last post by:
I am writing a Windows MDI application in C#. I would like to cast an object to a specific type. I know that the object is of a compatible type. The code below shows what I would like to do, but...
4
by: hazz | last post by:
I have inherited code but don't know exactly what this one line of code is doing? What it is the purpose of (ClassFileName)ClassFileName......... > ClassFileName vs2 = (ClassFileName...
5
by: miki | last post by:
Hi all, How can I cast from a string to an object? For example, suppose I have classes as employee, manager, supervisor, director,...I have a user interface that takes a person name, then...
8
by: GlennDoten | last post by:
I just happened to be looking through the implementation of the System.Version class in the SSCLI and one of the constructors starts like this: public Version(String version) { if ((Object)...
17
by: Hazz | last post by:
In this sample code of ownerdraw drawmode, why does the '(ComboBox) sender' line of code need to be there in this event handler? Isn't cboFont passed via the managed heap, not the stack, into this...
3
by: mra | last post by:
I want to cast an object that I have created from a typename to the corresponding type. Can anycone tell me how to do this? Example: //Here, Create the object of type "MyClass" object...
3
by: John Howard | last post by:
Making the following call to a local MSAccess database works fine: Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Dim intRows As Integer Dim strSQL As String Dim ds As New...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...

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.