|
CBenac wrote: It appears that the thread went totaly out of the subject.
I don't feel responsible for that, and I think I already answered your question.
Now if you want a calculator (real ones have state), then create a Calculator class as I said before. Make it static, a singleton, or a normal class, that's up to you. The really reusable one is the normal one.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Luc,
Yes, you already answered the question. Thanks. I'm going with static.
I only used the calculator class as an example, I'm not the type to reinvent the wheel.
|
|
|
|
|
How about inheriting from it? Just a thought.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
And what will this do for them?
only two letters away from being an asset
|
|
|
|
|
May be I misunderstood the thing. If the OP has a class say BaseClass which contains common methods that will be used throughout the application AND if there is a feasibility of using inheritance(since we do not have multiple inheritance) then maybe he can inherit the base class. That way, he would be able to access the common methods without creating objects for the base class. Does that sounds OK or has flaws in it?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
and if there is a need later to add more methods to support additional functionality every derived class will need to be updated, regardless of whether they need the functionality or not. Do you see any flaws here?
Remember the "is a" relationship with inheritance. I can't think how that would apply to the OP's situation. If you want to use String.Format in your class do you derive from String?
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: if there is a need later to add more methods to support additional functionality every derived class will need to be updated, regardless of whether they need the functionality or not.
Not sure about this thing. If I inherit from a class, and later sometime I change the base class, how would that affect child classes which do not need the newly added methods?
I just created a sample solution. There, class X (not an abstract class) had a protected method Test1. I inherited that in class Y. I had called Test1 in the constructor of Y. Then, I added another method in class X. I ran the application again. Worked fine. Are we at the same page?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Sorry, yes I was think abstract classes or methods. However; I still don't view it as applicable or a good design for this situation.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: I still don't view it as applicable or a good design for this situation.
Can you please elaborate? I seem to be blinded by this approach. Cannot see any problems with this.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
From my previous post
Remember the "is a" relationship with inheritance. I can't think how that would apply to the OP's situation. If you want to use String.Format in your class do you derive from String?
For utility methods, as decribed by the OP, there is no "is a" relationship. There is functionality that can be reused for a variety of situations with no dependencies or need to inherit. If the functionality is applicable to certain class I would consider an extension method, unless there truely was a heirarchial relationship between the objects.
only two letters away from being an asset
|
|
|
|
|
Hi guys, how could i rewrite this for Oracle. could someone please help me out.
IF NOT EXISTS (SELECT * FROM employee WHERE employee_TITLE='Main')
BEGIN
INSERT INTO employee (employee_TITLE) VALUES ('Main Page')
END;
|
|
|
|
|
How does this relates to C#?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
|
Thank you for reading.
I am attempting to propagate a nesting list architecture for use of displaying in a Tree View for management of text content, however I am having an issue with the serialization.
When attempting to populate my objects from serialization, I get the following error "There was an error reflecting type 'newClipboardManager.Directory'." with an inner response of "There was an error reflecting property 'ContextMenu'."
I would exclude all of the other members which are attempting to populate with the serialization, however the xmlIgnore is not something I can access. I would prefer to only have my important datamembers serialize, however I am at a stopping point. You can use the following snips for a reference:
Directory Class:
public class Directory : TreeNode
{
public string DirName
{
get{ return DirName;}
set{
DirName = value;
Name = value;
}
}
public List<note> Notes { get; set; }
public List<Directory> SubDirectory { get; set; }
#region contructors
public Directory()
{
this.Notes = new List<note>();
this.SubDirectory = new List<Directory>();
}
public Directory( string dirName, List<note> notes )
{
this.DirName = dirName;
this.Notes = new List<note>();
this.SubDirectory = new List<Directory>();
this.Notes = notes;
}
public Directory( string dirName )
{
this.DirName = dirName;
this.SubDirectory = new List<Directory>();
this.Notes = new List<note>();
}
#endregion
public Directory getArray()
{
if (Notes.Count > 0)
{
foreach (note not in Notes)
{
this.Nodes.Add(not);
}
}
if (SubDirectory.Count > 0)
{
foreach (Directory dir in SubDirectory)
{
this.Nodes.Add(dir.getArray());
}
}
return this;
}
}
Content Class:
public class note : TreeNode
{
public string noteName {
get { return noteName; }
set {
noteName = value;
Note = value;
}
}
public string Note { get; set; }
public int ID { get; set; }
}
Is there any simple method to ignore outlying data members for serialization? I have googled quite a lot and I am having a hard time with anything I find.
|
|
|
|
|
Hi all
I want to import an excel file to a DataGridView .
suppose we have 4 field in the Excel file (Code , Bank, Country, Amount) .
when i want to fill this File in a DataTable , I want to Add Another Field name "ID" in the DataTable (when I want to import the file)and then display it in the DataGridView .
How can I do this.
thank u for any Help
|
|
|
|
|
Best way would be to do that using an OleDb connection. This way you would get the datatable right away. To connect to Excel, take a look at connectionstrings.com.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
yes , but i want to create Another Field name "ID" apart from Excel file , and i want to add this field "ID" in a datatable .Then display "ID" field and "Excel file" to a datagridview .
(if i create the field of "ID" in the DataGridView Manually , infact , it's not belong to a DataTable).
|
|
|
|
|
You can add the column to the datatable once it is filled. And then bind it to the grid.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I don't Know this , Can u help me ...
thanx
|
|
|
|
|
Hi all,
I using C# with MDIParent.
After I click child form it show in MDIparent, but when I click another action in child form, how can I show that in MDIParent?
Thanks
Socheat
|
|
|
|
|
What do you mean? Can you please rephrase your question?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
|
VARGHESE--# RINSON # wrote: advatages of c#?
Please do not repost your question, especially one that is largely meaningless.
|
|
|
|
|
|
VARGHESE--# RINSON # wrote: why v going for c#?
I don't know what this means to you, but it means nothing to us. If you have a programming problem please try to describe it clearly.
|
|
|
|