Leaders Iceplug Posted March 23, 2004 Leaders Posted March 23, 2004 OK, I've looked through my documentation and searched... and haven't found anything like this: In VB, you can make property procedures with parameters: Public Property TileData(ByVal Col As Integer, ByVal Row As Integer) As Short Get Return mTiles(Col, Row).Data End Get Set(ByVal Value As Short) mTiles(Col, Row).Data = Value End Set End Property Is the same possible in C# or something similar? When I try using it, I get errors-a-plenty. :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
*Gurus* divil Posted March 23, 2004 *Gurus* Posted March 23, 2004 Look up indexers. public int this[int col, int row] { get {} } Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
mocella Posted March 24, 2004 Posted March 24, 2004 True - but only as the default property for a class, so if you need more than one indexed property in this class, you're out of luck. But, if you just need one, you're good to go. I also went through this unfortunate discovery a while back, only to find another perk that vb.net gives you. Quote
Leaders Iceplug Posted March 24, 2004 Author Leaders Posted March 24, 2004 Hmm... I was afraid of that. :( (But I did learn about indexers yay!) :) I guess that means that I'd have to make a class for each one of these parameters that I want for arrays. Thanks! :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.