|
Can anyone please send me the scenarios, where will we use shadowing and overriding.
Thanks
Siva
|
|
|
|
|
Normally you don't want to shadow methods in a class, because this hides functionality in a base class. However there are situations where you rather want to shadow methods to make them protected or private.
Overriding is commonly used to extend functionality provided in the methods of the base class. This is done more often in custom controls and classes that extend the .NET framework functionality.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
Lets say I have an application called Widgets.exe which references, via the GAC, CommonLibrary.dll. This application and its commonlibrary is then deployed to 1000's of devices.
Fast forward a few months and a small bug is found inside commonlibrary. This bug can be fixed without making any changes to Widgets.exe. The relevant developer diligently applies the necessary fixes to CommonLibrary.dll and as a matter of course increases the version number of the library. This is then redeployed, however as Widgets.exe has not changed this is not redeployed.
The problem now is that although the public method interfaces on the CommonLibrary have not changed Widgets.exe is expecting to find version 1.0.0.0 of CommonLibrary in the GAC, however this has now been replaced with v1.1.0.0 (which contains the bug fix). So at runtime a not found exception is thrown by the application.
Now I perfectly understand this and can see why this occurs etc etc. However the problem I have relates to this and how to manage it in the real world. In the real world, Widgets.exe is actually a very large application framework with many executables, assemblies and common libraries. I am trying to find a way to avoid having to redeploy, uninstall, reinstall the application in its entirity should a minor change be made to one of the common libraries.
At the moment to get around this we dont actually use .NET versioning as it should be. At compile time everything in the entire project is compiled to v1.1.0.0 and then we add a revision number to the AssemblyDescription property in AssemblyInfo.cs. This then means we can redeploy single libraries without breaking the dependency/reference chain. The version number would only be increase should a fundamental change be made.
While the ghetto style solution works, it doesnt sit very comfortably with me. So the question is can anybody suggest an alternative/better solution to this issue?
-- modified at 12:39 Tuesday 31st July, 2007
|
|
|
|
|
A trick I use is to change the file version not the assembly version. This will prevent older versions of my app from going down with a patch. Of course if you develop an entire new version of the CommonLibrary and your application it's best to update the assembly version as well. This will help with the problem of having an old assembly with the new application.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
I have a still frame from a live video feed where the camera is pointed at a rectanglar form. The form is of known dimensions. I have got it to the point that my program can look at the still at recognize the four corners. I therefore have 4 2d points of that form. What I want to be able to do is translate those known points into positional data in a 3d game. That is i need to know the rotation (pitch, bank, yaw), and position of the rectangle in relation to the camera. It seems like this should be possible but I dont really have the first clue about how to approach it. Can anyone point me to an article or website that would help me work through this problem. Or at the very least give me some idea of what I should be searching for? I know this sort of thing has been done, but I dont know what it is called to look for it. Let me know if I am being unclear.
|
|
|
|
|
Hi All,
I have Some Interface in my project that some classes are inheritor from this interface.
And i have also a collection that hold objects that inheritor from this interface ( this meed that the collection will holding this interface objects ).
I define some indexer that return object from this collection ==> this meed that the return type of this indexer is this Interface.
When i compile my project i getting this error message
Inconsistent accessibility: indexer return type 'IMyInterface' is less accessible than indexer '...this[int]'.
What is the problem ?
I cant return type of IMyInterface ?
Thanks for any help.
|
|
|
|
|
Hmmmm that sounds mighty odd.
Any interface should be public and so by definition can't be less accesable than the indexer.
Can you post you Interface declaration and the indexer?
|
|
|
|
|
No, members of an interface are public by default. The interface itself can have whatever access modifiers you choose to place on it.
|
|
|
|
|
As a test, create a project in VS2005 and add an interface to it (by selecting interface in the add items dialog). You will find that the interface is not declared public. Suppose that I'd created an interface called IMyInterface, I'd get the following:
interface IMyInterface
{
void DoThis();
} In order to use this interface externally, you have to add the public access modifier before the interface keyword.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Oh it defaults to internal ... wow, I learn something new every day
I always explicitly put in my access modifiers anyway so I guess thats why I've not come across this before.
|
|
|
|
|
you probably have the Interface defined as private and the indexer defined public.
Make sure the Interface definition explicitly includes the access modifier public as by default they are private
-- modified at 11:57 Tuesday 31st July, 2007
|
|
|
|
|
Primary key for the table is (Name, Data).
How to show data like this:
Name1.....Name4
------.....------
Data11....Date41
Data12
Name2
------
Data21
Data22
Data23
Name3
------
Data31
...
|
|
|
|
|
I'm not sure exactly what you're trying to do. If you only have two columns (Name, Data), you cannot return separate columns for each row. I would return the data you need and then any really fancy formatting would need to be done on the UI. Give some more info and perhaps I can help you some more. Thank you.
|
|
|
|
|
Thanks for your answer.
I must to show telephone numbers of clients in this way.
Certainly, they may to have more phones and each of them must be visible.
It is all dispose in more columns, that economically use working surface.
|
|
|
|
|
I am using DB2 and C# to develop a web app.I got a problem in adding a new row.My table has Time field in DB2 which is in hh.mm.ss format.In Dot net the equivalent format is hh:mm:ss.My problem is how can I convert the hh:mm:ss(in .NET) to hh.mm.ss in DB2?
I need urgent help
kidus
|
|
|
|
|
Hey all,
I hope that there is someone out there that can work out what is going on with my application!
I am a n00b trying to use ODBC drivers to update a remote MySQL database, and as such i have been trying to piece code i have found on the internet to get it working. I am able to connect to it fine and even display the contents of any table in a data grid. However, I am unable to get the program to update the database when i make changes inside the datagrid.
I could be completely n00bing out, but i jsut cannot seem to get this to work. The code below is a program i wrote which simply replicates the part of my main application which displays the table name "Paterson" on the MySQL database in a data grid and when the 'btnUpdate' button is pressed, this MySQL table is/should be updated by the contents in the datagrid.
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Data.Odbc;<br />
<br />
<br />
<br />
namespace CannotUpdateTables<br />
{<br />
<br />
<br />
public partial class Form1 : Form<br />
{<br />
<br />
private System.Data.Odbc.OdbcConnection OdbcCon;<br />
<br />
private System.Data.Odbc.OdbcDataAdapter DataAdapter;<br />
private DataSet DataSET;<br />
<br />
private string ConStr;<br />
<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
<br />
<br />
ConStr = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" + txtIP.Text + ";PORT=" + txtPort.Text + ";DATABASE=" + txtDatabase.Text + ";UID=" + txtUsername.Text + ";PWD=" + txtPassword.Text + ";OPTION=3";<br />
<br />
OdbcCon = new System.Data.Odbc.OdbcConnection(ConStr);<br />
<br />
try<br />
{<br />
txtLog.AppendText("Openning connection...\r\n");<br />
if (OdbcCon.State == ConnectionState.Closed)<br />
{<br />
OdbcCon.Open();<br />
}<br />
txtLog.AppendText("Connection opened\r\n");<br />
<br />
<br />
<br />
DataAdapter = new System.Data.Odbc.OdbcDataAdapter("SELECT * FROM Paterson", OdbcCon);<br />
<br />
<br />
DataSET = new DataSet("TableData");
<br />
<br />
DataAdapter.Fill(DataSET);
<br />
<br />
dataGrid.DataSource = DataSET.DefaultViewManager;<br />
<br />
<br />
}<br />
<br />
<br />
catch (System.Data.Odbc.OdbcException Ex)<br />
{<br />
txtLog.AppendText(Ex.Message + "\r\n");<br />
MessageBox.Show("Could not access the database and Display Table.\r\nPlease make sure you completed the fields with the correct information and try again.\r\n\r\nMore details:\r\n" + Ex.Message, "Database connection error", MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
}<br />
<br />
<br />
<br />
<br />
}<br />
<br />
private void btnUpdate_Click(object sender, EventArgs e)<br />
{<br />
try<br />
{<br />
<br />
DataAdapter.TableMappings.Add("Paterson", "TableData");<br />
DataAdapter.Update(DataSET, "Paterson");<br />
DataAdapter.TableMappings.RemoveAt("Paterson");<br />
<br />
txtLog.AppendText("Table Paterson successfully Updated\r\n");<br />
}<br />
catch<br />
{<br />
txtLog.AppendText("Table Unable to Update\r\n");<br />
}<br />
}<br />
<br />
}<br />
}
As the code is displayed below i am told that the table is updated fine. However, the table is not updated. I know these lines must be wrong as if i change "Paterson" or "TableData" in them the middle line DataAdapter.Update(DataSET, "Paterson"); gives exceptions (either about incorrect table mapping or simply that it cannot find the TableSet[Paterson] or whatever.
THIS WAY GIVES NO RESPONSE
DataAdapter.TableMappings.Add("Paterson", "TableData");<br />
DataAdapter.Update(DataSET, "Paterson");<br />
DataAdapter.TableMappings.RemoveAt("Paterson");<br />
I have been pulling ym hair out for two days as it jsut doesnt update the table on the MySQL database.
If i anyone can help me i will be forever in your debt. I am an obdc n00b and am probably just missing something out!
Many Thanks
Alex
-- modified at 9:48 Tuesday 31st July, 2007
|
|
|
|
|
][cecu3e wrote: I hope that there is someone out there that can work out what is going on with my application!
I found what is wrong
][cecu3e wrote: I am a n00b trying to use ODBC drivers to update a remote MySQL database, and as such i have been trying to piece code i have found on the internet to get it working.
That's wrong on so many levels
|
|
|
|
|
lmao, yeh i probably sound like the dumbest man alive, its all been going well until this.. ive almost no experience with this so my descriptive terminoligy is probably way off. im just tryin to get that update command to work....
lol, also when i say im jsut piecing other peoples code together im not doing it in a literal sense, im using other FAQs to write this, attempting to understand this odbc connection stuff
soz..can u shed any light?
|
|
|
|
|
Try:
DataSET.AcceptChanges();
Also, "Bob" is a much nicer name for a database table; surnames are reserved for school and the military
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
hehe, true and thnx for the reply, unfortunatly it doesnt make the table update
i ammended the code to (i have placed it after the mapping too, jsut in case..):
lol, also changed the table name to test!
DataSET.AcceptChanges();<br />
DataAdapter.TableMappings.Add("TableData", "Test");<br />
DataAdapter.Update(DataSET, "TableData");<br />
DataAdapter.TableMappings.RemoveAt("TableData");
But it still doesnt update the mysql table
im am very confused, i think maybe my DataAdapter.Update() line may be wrong
many thanx again, i think i need your added line aswell as the code fix!
Can anyone help, im going insane with this one :P
-- modified at 12:20 Tuesday 31st July, 2007
|
|
|
|
|
Does anyone knows the simple yet powerful algorithm in solving Systems of linear equations?
Thanks!!
|
|
|
|
|
that is "LU decomposition" well known to Google and the rest of the world.
|
|
|
|
|
How can i expose the public enum created in c# form to the vb6 application?
-Amit
|
|
|
|
|
I don't believe you can expose the C# form to the v6 application, but you can expose that enum to a vb6 by creating a dll and adding a reference to it.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
There is a new toolkit from Microsoft for exposing .NET UI stuff to VB6 apps, but I can't remember what it is called.
|
|
|
|