Click here to Skip to main content
15,890,609 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I fill a Combobox while writing? Pin
John Torjo16-Nov-15 0:18
professionalJohn Torjo16-Nov-15 0:18 
AnswerRe: How can I fill a Combobox while writing? Pin
John Torjo16-Nov-15 0:16
professionalJohn Torjo16-Nov-15 0:16 
GeneralRe: How can I fill a Combobox while writing? Pin
Member 1191673518-Nov-15 1:47
Member 1191673518-Nov-15 1:47 
GeneralRe: How can I fill a Combobox while writing? Pin
John Torjo18-Nov-15 2:10
professionalJohn Torjo18-Nov-15 2:10 
AnswerRe: How can I fill a Combobox while writing? Pin
PANKAJMAURYA16-Nov-15 0:25
professionalPANKAJMAURYA16-Nov-15 0:25 
GeneralRe: How can I fill a Combobox while writing? Pin
Member 1191673518-Nov-15 2:08
Member 1191673518-Nov-15 2:08 
GeneralRe: How can I fill a Combobox while writing? Pin
PANKAJMAURYA18-Nov-15 17:19
professionalPANKAJMAURYA18-Nov-15 17:19 
Questioncall an api in c# Pin
Member 1212120115-Nov-15 21:25
Member 1212120115-Nov-15 21:25 
AnswerRe: call an api in c# Pin
OriginalGriff15-Nov-15 21:44
mveOriginalGriff15-Nov-15 21:44 
AnswerRe: call an api in c# Pin
Afzaal Ahmad Zeeshan16-Nov-15 2:19
professionalAfzaal Ahmad Zeeshan16-Nov-15 2:19 
AnswerRe: call an api in c# Pin
Dave Kreskowiak16-Nov-15 4:06
mveDave Kreskowiak16-Nov-15 4:06 
AnswerRe: call an api in c# Pin
Pete O'Hanlon16-Nov-15 5:51
mvePete O'Hanlon16-Nov-15 5:51 
GeneralRe: call an api in c# Pin
Member 1212120116-Nov-15 17:50
Member 1212120116-Nov-15 17:50 
AnswerRe: call an api in c# Pin
Gerry Schmitz16-Nov-15 18:40
mveGerry Schmitz16-Nov-15 18:40 
QuestionDocument to represent a document node in a print queue Pin
Tridip Bhattacharjee14-Nov-15 1:08
professionalTridip Bhattacharjee14-Nov-15 1:08 
AnswerRe: Document to represent a document node in a print queue Pin
OriginalGriff14-Nov-15 1:21
mveOriginalGriff14-Nov-15 1:21 
QuestionPrint Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 1:06
professionalTridip Bhattacharjee14-Nov-15 1:06 
AnswerRe: Print Queue implementation by linked list class Pin
OriginalGriff14-Nov-15 1:20
mveOriginalGriff14-Nov-15 1:20 
GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 5:12
professionalTridip Bhattacharjee14-Nov-15 5:12 
GeneralRe: Print Queue implementation by linked list class Pin
OriginalGriff14-Nov-15 5:29
mveOriginalGriff14-Nov-15 5:29 
GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 5:22
professionalTridip Bhattacharjee14-Nov-15 5:22 
GeneralRe: Print Queue implementation by linked list class Pin
OriginalGriff14-Nov-15 5:35
mveOriginalGriff14-Nov-15 5:35 
GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 8:27
professionalTridip Bhattacharjee14-Nov-15 8:27 
GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 18:33
professionalTridip Bhattacharjee14-Nov-15 18:33 
GeneralRe: Print Queue implementation by linked list class Pin
OriginalGriff14-Nov-15 23:23
mveOriginalGriff14-Nov-15 23:23 
No.
From a personal POV, I wouldn't use a tail unless I really had to - it complicates things, and it far to easy to mess it up. I'd traverse the list (or actually use a Queue rather than a linked list anyway).

But...
Why are you returning a new node on Pop? What's wrong with the actual node? Why waste time creating a new one, when it may not be the same as the original in all respects?

Why do you have a public nextnode property and a setNext method? Dump the method and make the setter public as well.

If you are going to use XML comments (and it's a good idea) use them consistently: i.e. every public object should have a "proper" comment.

What happened to the abstract Document class?

Why does your test code not check for nulls? There is no point in returning null for an error if you don't check for it anywhere!

Why do it like this:
C#
content = node.document.Name + ": " + node.document.Type;
while (node.nextnode != null)
{
    node = node.nextnode;
    content += "\r\n" + node.document.Name + ": " + node.document.Type;
}
Try changing it round:
C#
while (node.nextnode != null)
{
    content += node.document.Name + ": " + node.document.Type + "\r\n";
    node = node.nextnode;
}
Or better, use a string builder:
C#
public string DisplayContents()
{
    StringBuilder content = new StringBuilder();
    Node node = head;
    while (node != null)
    {
        content.AppendFormat("{0} : {1}\n", node.document.Name, node.document.Type);
        node = node.nextnode;
    }
    return content.ToString();
}

And why is Document a part of Node? Is there a good reason? I can see why you might want them to be separate classes, but...
If Node inherited from Document that would make sense, or even if Document inherited from Node - but making it an encapsulated class feels very wrong, and complicates your code.

I'd probably make Node an abstract class, and inherit an abstract Document from that, then inherit the concrete PdfDocument and WordDocument you were using previously from there.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...


modified 15-Nov-15 7:57am.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.