brentnewbury
Members-
Posts
15 -
Joined
-
Last visited
About brentnewbury
- Birthday 01/06/1984
Personal Information
-
Occupation
Assistant Web Developer & Editor
-
Visual Studio .NET Version
Visual Studio .NET 2003
-
.NET Preferred Language
C#
brentnewbury's Achievements
Newbie (1/14)
0
Reputation
-
Just tried it then realise the reason why I didn't use this method; I don't want anything outside the Article class to be able to add/remove pages. The reason for this is that the Article constructor takes one parameter; the Article ID. From there the constructor initialises the class and sets up pages etc. All I need to do is get pages, so to be honest, I think I may just use a standard public Page GetPage(int pageNumber) {}. Thanks alot for all your help. Like I said, I didn't get any sleep last night. :yawn: :D
-
Damn! I finally get what you mean. Like a prat I just didn't think about proper collection classes! (I have been awake for 28 hours :yawn: :) Thank you for the advise.
-
I have a Article Class that has a list of Pages. To me, myArticle[0]; seems to completed ignore the relationship between an Article and it's Pages. myArtical.Page[0]; seems to model the relationship quite well between an Article and it's Pages.. I'm finding it difficult to articulate what I have in my head. Regardless of the programatical limitation of the framework, this seems the better model of the problem space. Personally, I'd say Microsoft was wrong in it's implimentation. Just to reitterate myArticle[0]; seems like an array of Articles, whereas myArticle.Page[0]; is definately a collection of pages that are attached to a particular instance of an Article.
-
Eureaka! The best solution I've come up with so far is: public IList<Item> Items { get { return this._collection.AsReadOnly(); } } I've attached a working solution (see bellow). The idea behind this is to stop any abuse due to exposing the underlying collection, like so: public List<Item> Items { get { return this._collection; } } Give me a shout if you see any problems :). (Apart from the run-time checking) - Brent NamedIndexer.zip
-
The problem with public List<Item> Items {} is that you expose the entire underlying collection. Declaring the collection as readonly seems to have problems of it's own. I don't understand why Microsoft just doesn't expand System.Runtime.CompilerServices.IndexerName("...") for use with all languages under the .NET framwork and not just that ones that don't natively support indexers. There must be some good reason. Atleast I hope there is. Come on Microsoft, I want to know why, give me the details, I want to understand!
-
Well bloody hell! I've just been searching for bloody hours trying to find stuff about named indexers (e.g. System.Runtime.CompilerServices.CSharp.IndexName("..."), System.Runtime.CompilerServices.IndexerName("..."), etc). I'm bloody annoyed with myself! But why don't Microsoft just have named indexers, why is this keyword compulsory? Are they trying to enforce a wierred and wonderful object oriented ideal?
-
Hiya all, I'm not a newbie to .NET by any means, but I've obviously missed something big here. For some reason I can't seem to get indexed properties to work! Well, not in the way I want (and think to be most logical), I can get them to work like: public int this[int index] { get { ... } set { ... } }but not like this: public int Item[int index] { get { ... } set { ... } }I know I seem dumb, but to me it doesn't seem logical to have the item itself manage it's own collection. To me it seems more logical to have the owning class manage a collection of its subordinates. Here's the code I would like to use: using System; using System.Collections.Generic; public class Collector { private List<Item> _collection; public Item Items[int index] { get { return this._collection[index]; } set { this._collection[index] = (Item)value; } } // Other members, properties, and methods public class Item { // Members, properties, and methods } }Do any of you have any advice? Regards, Brent
-
Hiya onez7285, It seems as though you are trying to debug your complicated loops. If I am correct may I suggest using Break Points instead of Console.ReadLines()'s and setting Break conditions on the Break Points. Happy Coding :D Brent Newbury
-
Hiya unbreakable, Here is a small section out of the Developing Windows-Based Applications using Visual Basic.NET and Visual C# (Microsoft Press) Hope this helps :D Brent Newbury
-
If you are using Visual Studio; you may havew to add them *** references to your project. Happy Coding :D Brent Newbury
-
Hiya unbreakable, I don't know of any way to log or report memory consumption, but you can use Tracing and and a few other tools to help you diagnose performance bottlenecks. When I get home, I'll try to remember to paraphrase a chapter out of Developing Windows-Based Application (with Visual Basic .NET and Visual C#) which is part of the MCSD .NET Core Requirements set. This chapter tells you the techniques to diagnose performance bottle-necks. Hope this helps :D Brent Newbury
-
Hiya newbie101, I have no experience using barcode scanners but then general idea would be to have a thread running that will "listen" for barcodes being scanned. Once a barcode is detected it would be processed and then the "listening" thread would start to "listen" again. I hope this makes sense. Happy Coding :D Brent Newbury
-
Thank you Mykre, That sounds like a good idea. I think I may have a look at that. Brent Newbury
-
Hiya Mykre, I agree with what you said about port forwarding however, Windows/MSN Messenger do not need any port forwarding to be setup (well, they aren't on my Windows Server 2003 home server). I was wondering how this was accomplished. Thank you for your time, Brent Newbury
-
Hiya all, I'm trying to create a sample Peer 2 Peer chat application. However, I'm having trouble with Network Address Translation (NAT). Programs like MSN/Windows Messenger use NAT (I know they aren't coded in C# :)). However, when I'm sending or listening for information I'm using TCP Listeners and Clients. The example I'm using is at http://www.cshrp.net/content.aspx?showID=547. When I run my application I have to route the ports on my home server. Is there any way I can connect to applications over the internet and not have to worry about configuring port routing? Thank you for your time. Brent Newbury