|
Hi,
In a interface i am using private access specifier , will compling will it give error or not, if it give error then what is that error.
thanks
|
|
|
|
|
NO! its not allowed to put any access modifier behind function defination in interface, be it private, public, protected or internal.
Ali
|
|
|
|
|
Using a private in an interface is illogical.
The private specifier is telling the compliler that the method/property/field is accessible to ONLY other members of this specific class. As interfaces have no implementation nothing could ever use something declared as private within an interface.
As a general note: Interfaces are definitions for part of an exposed parts of a class so that other code can see that a class implements an interface and therefore know that it can call certain methods or properties even if it knows nothing else about the class.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
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.
|
|
|
|