|
Are the objects in the array marked as [Serializable]? When you debug, can you see the objects in the array?
|
|
|
|
|
Well, actually, they're not marked as [Serializable]. During debugging, I can see there are 5 array members, and the debugger returns the correct type (MyWebService.MyClass, for example), but that's it, I can't access them, I can't do anything with them. Now, that's probably because that array of objects are created on the service side, and they sre returned to the client. Maybe it would help if I instantiated the array on the client, and send that array to the service to be "filled"? But the problem is the size of the array - I can't predict that, and it would be silly to set it to 100 and it's count is only 3.... Maybe I can use ArrayList instead? The problem is that I'm new to web services (although not to win forms programming), so I don't know much about serialization... So any tips will be appreciated...
|
|
|
|
|
I want to create one bluetooth application which can send commands to a robot which is having a bluetooth receiver.I am clear till the application that sends the bt signals to robot but from receiver side what should I do?Can Any one tel me.How can I do programming there in C#.
nishu
|
|
|
|
|
Hi guys,
I have a class that extends an IMenuProvider interface and belongs to a plug-in project. In the UI project(other project) I've developed a menuService class that finds plug-ins that implement a IMenuProvider interface and execute the constructor method by using the invoke method. Here's the code.
<code>...
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
if (type.GetInterface("IMenuProvider") != null)
{
if (!ht.ContainsKey(type.FullName))
{
ConstructorInfo cinfo = type.GetConstructor(System.Type.EmptyTypes);
IMenuProvider imp = (IMenuProvider)cinfo.Invoke(null); **
ht.Add(type.FullName, imp);
RegisterProvider(imp);
}
}
}
...
</code>
So what happens is the line marked with ** returns an error saying "Unable to cast object of type 'TestPlugin.PluginMenuProvider' to type 'Enki.UI.ComponentModel.IMenuProvider'."
I know that I’m attempting to invoke the constructor method of the subclass PluginMenuProvider through the extension IMenuProvider but i don’t want to have to specify every subclass that extends the IMenuProvider interface.
Now, my question is how can i invoke the constructor without having to declare and than cast each class type that extends the interface IMenuProvider like the line marked with ** does?
Best regards.
Pedro M.
|
|
|
|
|
Jost Pedro wrote: execute the constructor method by using the invoke method
Invoking constructors might have a place but I would avoid it. From a design perspective I would use a Creational Design Pattern.
led mike
|
|
|
|
|
|
How about simply using Activator.CreateInstace[^] instead, especially considering that the constructor doesn't take any parameters? That's the typical way in which objects are created using reflection.
Type[] types = assembly.GetTypes(); foreach<span> (Type type </span>in<span> types) </span> { if<span> (type.GetInterface(</span>"IMenuProvider"<span>) != </span>null<span>) </span> { if<span> (!ht.ContainsKey(type.FullName)) </span> { IMenuProvider imp = (IMenuProvider)Activator.CreateInstance(type);
...
|
|
|
|
|
Hi
how to programmatically get the name of the user who is currently logged-in to the windows.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
System.Environment.UserName
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hey all,
I have an abstract class which defines some functions, WITHOUT declaring them virtual .
When I derive from that class, I simply use the override keyword and declare the same signature for the function.
It works perfect AFAICT...
Is there any place we are forced to use the virtual keyword?
Is it wrong not to use it?
Does it break the polymorphism rules?
Thanks in advance,
Shy.
|
|
|
|
|
That's weird. In order to be able to mark a method with override the base class method must be either itself override , abstract or virtual .
... or on my compiler it does anyway.
Regards,
Rob Philpott.
|
|
|
|
|
I do declare the functions as abstract ...
Just not virtual .
|
|
|
|
|
ah ok. virtual is implied from abstract , as an abstract method can't have an implementation, one must be supplied by each child class.
If it wasn't implicitly virtual, you'd not be able to call the method on a base class reference.
Regards,
Rob Philpott.
|
|
|
|
|
An abstract method is also automatically virtual.
---
b { font-weight: normal; }
|
|
|
|
|
Oh... I see...
Thanks guys...
HAND...
|
|
|
|
|
Hello all,
What will be benefit if we use parameterised transactions for inserting, updating records.
For a large scale development which should be better the simple sql complete query based solution or parameterized solution.
|
|
|
|
|
|
Hi
i am new to the world of C# and previously have worked on C++ and C. i have made certain applications using c# but i am not confident on it. Whats the Best way to do learn c# in shortest time?
PLz help
Thanks
Sankalp Verma
|
|
|
|
|
Since you already have a grasp on C++, C# is mostly going to be a search for the correcet namespace. I would recommend a book from Wrox or OReilly on your subject of choice. Keep in mind that Windows (Winforms) and ASP.NET as very different animals. Same syntax, just many different namespaces.
|
|
|
|
|
Thnaks for that idea but there are hell of things in C# like WMI , web based applications ADO.Net ADSI etc and its hee that i get confused that what shall i do?
My main work area is Networking and we need to write script files based on windows.can you tell me is C# the best language to do so or shall i go for WSH or VBS?????
Sankalp Verma
|
|
|
|
|
I may be wrong, but I believe most networking is done in VBS.
There are several articles here that may help you in c# or C++:
http://www.codeproject.com/cs/system/cstcpipwmi.asp
http://www.codeproject.com/dotnet/adduseracetofile.asp
http://www.codeproject.com/w2k/adsiuserdmo.asp
|
|
|
|
|
|
|
hi verma,
we r sailing in the same boat. i am also new to C#.
it is better to do some sample appliations which are related to real time applications.
and work practically each and every concept of C#.
already u r into C++ (into Object oriented Programming), so u should not worry much about C#.
i saw one site,and felt to good for one who is new to C#. it is csharp-station.com.go thru the each and every lession in the Tutorial. and work on their samples.
this site(i mean www.codeproject.com) is also very usefll for us. in
General C# sections, u will find C# Samples. they are really good to learn C# coding standards.
all the best,
rahi
|
|
|
|
|
hi all,
i want to ask a few questions about controlling internet explorer with C#:
* let's assume i am using IE7:
1. (if my browser is open)
- how can i change the first tab's url ? (assume there are a few open tabs)
- how can i add a new tab & open a url ?
2. (if my browser is not open)
- how can i start ie7 with and url ?
* let's assume i am using an older version of IE
1. (if there are a few open IEs)
- how can i change the first IE's (first one on the TaskBar) url ?
- how can i open a new IE with a url ?
thanks in advance, bye.
MFA
|
|
|
|