|
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.
|
|
|
|
|
hmmm... good question?
...Maybe C# stole something from V and that's why he is going after him...
...I think this is not an appropriate question for this forum. I don't even know these two people let alone their motivations towards each other
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
what is the difference between ref and out variables(in situation basis)....i know that ref should be initialized before its usage ...why its like that(what is the need of initializing ref)?
|
|
|
|
|
VARGHESERINSON wrote: why its like that(what is the need of initializing ref)?
ref = in + out
in ==> must have value
the C# documentation explains all.
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.
|
|
|
|
|
Well an OUT wont compile if you don't set it in the function, a REF does not need settings. Thou, why would you use a REF if you didn't plan on using it anyway. Maybe one path uses it, other path does not.
Maybe a better example would be if you were to re-use the value in other functions, for example consider the following sample...
ref int SomeData;
public void Setup(ref int data)
{
SomeData = data;
}
public void Add5()
{
SomeData += 5;
}
...pointless? Yes. Doe's it compile? I don't know. But would not work with the OUT parameter.
[EDIT] It does not compile
Next attempt...
If you where to design a class library that was to be used for somebody else then it could be useful.
You could use REF to ensure that the value was set before passing in, and you could use out if you didn't care what the value was to start with. Examples...
public void (out int i)
{
i = 10;
}
public void (ref int i)
{
i = i + 5;
}
...Maybe this is what Luc was getting at
[EDIT] Just me again...
I worked out a better usage. Consider the following struct instead of a basic datatype.
struct Sample{
public string A;
public string B;
public Sample(string a, string b)
{
A = a;
B = b;
}
}
If you use this struct with REF, then you can change B and keep A the same, if you use OUT then you are required to initialize the data and thus lose all data.
This is the same for passing Controls (for whatever reason you would want to)
Life goes very fast. Tomorrow, today is already yesterday.
modified on Wednesday, October 21, 2009 9:12 AM
|
|
|
|
|
musefan wrote: Maybe this is what Luc was getting at
What Luc was getting at most of all is: read the fine manual, don't be so damned lazy.
And read a book about the programming language you want to use; this is after all basic knowledge.
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.
|
|
|
|
|
"out" parameters are like return values, you must assign them before returning.
"ref" causes arguments to be passed by reference: any changes made to the parameter in the method will be reflected in that variable.
|
|
|
|
|
"out" is used when you need to return more values to the caller (for example a return code and other data), "ref" is used when the method can change the argument.
|
|
|
|