|
Hi,
if two methods having same signature but different return type then also we can say that is overloading?
Example:=
int sum(int x,int y)
{
//some code
}
string sum(int x,int y)
{
//some code here
}
Plz tell me, thanks
|
|
|
|
|
In my views, yes we can say this 'Overloading'
Ali
|
|
|
|
|
|
mowli wrote:
if two methods having same signature but different return type then also we can say that is overloading?
Computer says no.*
This is not valid because the compiler won't know what method implementation to run.
Consider the following call:
Console.WriteLine("{0}", sum(1,2)); Which of the two methods should it call? Console.WriteLine can accept an int or a string here, so the compiler wouldn't know what to do.
If you try and run this you will get a compiler message along the lines of "myClass already defines a member called 'sum' with the same parameter types"
* As you can tell, I've been watching Little Britain recently.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
I have a dataset that I read from an xml file using
DataSet.ReadXml(fs);
I then add to the dataset and rewrite the xml file using the following:
DataRow newrow = mf.quotesDataSet.Tables["quote"].NewRow();<br />
newrow["thequote"] = quoteInput.Text;<br />
newrow["speaker"] = speakerInput.Text;<br />
newrow["origin"] = originInput.Text;<br />
newrow["image"] = "test.jpg";<br />
mf.quotesDataSet.Tables["quote"].Rows.Add(newrow);<br />
mf.quotesDataSet.WriteXml(fw);
It does add the data, however, it adds it outside the main xml hierarchy. For example, instead of:
<rss><br />
<channel><br />
<quote><thequote>text</thequote></quote><br />
<quote><thequote>text</thequote></quote><br />
<quote><thequote>new text</thequote></quote><br />
</channel><br />
</rss><br />
it writes to the file as:
<rss><br />
<channel><br />
<quote><thequote>text</thequote></quote><br />
<quote><thequote>text</thequote></quote><br />
</channel><br />
</rss><br />
<quote><thequote>new text</thequote></quote><br />
how do I make the added rows to the dataset write into the proper hierarchy?
|
|
|
|
|
Hi all,
What is the best way to find out what dll to add to a project.
eg:- compiler says you need a namspace and reference to a dll for Server in 'Server.ScriptTimeout'.
Yes but what dll is needed?
How do you find out quickly which dll?
Thanks.
|
|
|
|
|
Hi!
How should the compiler know?
You're using a class Server , the code itself is syntactically correct, if Server is a known class, but where Server is defined cannot be determined until you tell the compiler by adding the reference.
Regards,
mav
|
|
|
|
|
Yes thanks.
But it is Catch22!
Some dll's are not install by default and you have to add the dll.
But how do you know which dll to install then add to the code with the 'using' statement.
You guys must use some tool/lookup method of finding the correct dll to reference that has the functionality that you require?
I've found http://www.dotnet247.com so far.
|
|
|
|
|
Are you referring to assemblies containing your own types or third-party components?
If they are your own assemblies, you and you alone know which types are compiled into which assembly.
If it's a third-party component, they must tell you which dll hosts which type and what to install in order for the component to work correctly.
Then you can set your reference according to this info.
But just by giving a classes name (like in your example) the compile cannot determine where to find it and which to use. You can have a zillion valid assemblies on your harddisk each defining a class Server (debug/release builds, different versions, incidental name collisions, ...). Which one do you want to use? I guess you don't want the compiler to pick one at random, do you?
To find a .NET type in assemblies you can use Lutz Roeders Reflector[^], for example.
If you need a COM reference you can use the OLE/COM object viewer available with VS.NET.
Regards,
mav
|
|
|
|
|
How can I initialize components readOnly properties at design-time?
|
|
|
|
|
Do you mean at run-time!? In design time you just select the values from the property window.
|
|
|
|
|
Thank you for reply.
I mean value initialization for readOnly properties via constructor.
But component has only two constructors (empty and with IContainer parameter).
So, components properties must have getters and setters.
To make property a readOnly at run-time I used Site.DesginMode flag in setters:
public int IntProperty<br />
{<br />
get<br />
{<br />
return intProperty;<br />
}<br />
set<br />
{<br />
if(this.Site.DesignMode)<br />
{<br />
this.intPropery = value;<br />
}<br />
}<br />
}
|
|
|
|
|
Hi,
i went for an interview, in that they asked one Question like that..
I am including one dll in to my application, then .Net sdk automatically copies that dll in to my bin folder, but i want to ristrict it from coping into my folder, can i do this? if yes how can u do that?
plz any one tell me.
thanks
|
|
|
|
|
|
Hi,Leppie
Thanks for answer, and u gave one xml site link, is it related to assemblises or not i am not understanding the code plz tell me.
Thanks
|
|
|
|
|
I guess you mean his signature...
What leppie said was that in VS.NET you can click on a reference in the project explorer to show its properties.
There's a property "CopyLocal" that controls whether the dll is copied to bin or not.
Regards,
mav
|
|
|
|
|
Hi,
What is the scope of assemblies.
thanks
aparna
|
|
|
|
|
|
I have two database one on server(oracle) and one on client(MSaccess) . I want to synchronise database beetween server and client. So I don't allow anyone to update, insert or delete on server database. How to clock a table that i want synchronise with client on server database. Help me
|
|
|
|
|
Well I also had to do such a project, but the other way around, I had to put data from the client (MS Access) into the SQL server.
I coded everything in vba in MSAccess. In my situation that code connects to the server, loops through all rows in my source table, and does an insert on the sql server.
If you need VBA code examples please let me know.
|
|
|
|
|
I have a text box and a datagrid. As the user types in the textbox I use a rowfilter to filter the datagrid. On my dev machine this works great. But on some other machines I end up with a problem: changing the rowfilter ends up calling the FocusInternal() method... the outcome is horrible: as the user tries to type in the textbox the focus is lost immediately.
Any ideas?
|
|
|
|
|
Check .NET Framework versions. Are they the same, or is yours using 1.1 SP1, and the other using 1.0 or 1.1 without SP1? Of course, there could be another issue, but this is worth looking at first. The easiest way to handle it is to make sure all the related machines have been updated to the latest .NET Framework and patches which are available on the www.windowsupdate.com[^]
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
hi
I need some information about tapi for dialup connectivity with server
If anyone has sample program for connectivity with dial up using modem in c#(desktop application)
I have Four TExt box in win form
One Text Box is for Address of Server
Second textbox is used for Tel number of The server which should connect with server
The functinalilty is same as
Dial up internet connection but here in my application i am connecting with
Database server through Dial Up
Third text box is used for User name of Server
Fourth text box is used for the Password of server
When I press the submit button It will fetch all the databases from Database server in Tree view control All Databases will be shown in Tree view control
Waiting for the prompt response with code
Warm Regards
sanjeev
|
|
|
|
|
Seriously, I have been fooling around with this code for a week or so and I always end up back to sqaure 1. Can anyone see any flaws in the theoretical setup below?
* I am using sockets (CLIENT/SERVER)
* I use Async code for the BeginAccept and EndAccept on the socket (SERVER)
* I use Async reading for the messages coming in (CLIENT/SERVER)
* Using a single thread to send messages on the socket which utilizes an ArrayList of messages, clones the arraylist, does a foreach then writes each message then removes the message from the original arraylist[not the cloned] (CLIENT/SERVER)
A big problem I am having is that messages will come in like:
MESSAGE:blah:connect
MESSAGE:blah:messageMESSAGE:blah:somethingMESSAGE:blah:networks blow
And obviously I am expecting the messages to come in one at a time. I assumed that if I wrote them synchronously then the async receiving should work the way I intend. Is there a problem with this? Any help or guidance would certainly be appreciated.
|
|
|
|
|
I believe that you are running into a feature of the system. When your software takes longer to read the communications from the socket, the messages will pile up. At the next read, you can then retrieve (with one call) all the messages which have been sent.
So, your network protocol needs some method of delineating between the end of one message and the beginning of another. Once you have that arranged, you ought to be free of this problem.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|