|
Thanks for your input! In conclusion I must just not have been paying attention to the C# books I glossed over...
Chris
|
|
|
|
|
c2423 wrote: Thanks for your input!
No problem. Man I sure missed an opportunity in replying to your other question!
c2423 wrote: (and I have been living under a rock until today)
I don't know, what's your address? I can look it up on Google Street View and tell you!
led mike
|
|
|
|
|
Indexers are nice and commonly used in the .NET framework. If you think they would make sense in your project and simplify the usage of it, then go for indexers.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes, they simplify my project (in one place I even save an *entire line* of code )
And I know that the framework contains them (for example when reading a SqlDataReader's values)
However, my question was more along the lines of "do people generally know of their existance?"
Anyway, thanks for your input - its good to know that its not an alien concept for people!
Thanks,
Chris
|
|
|
|
|
c2423 wrote:
However, my question was more along the lines of "do people generally know of their existance?"
I think most people use them intuitively when accessing chars in strings, items in lists, values by key in dictionaries and lots of other stuff. Whenever the user knows that there's more data inside a class they either look for a GetXXX -Method or go for indexers without actually knowing that they just use "indexers".
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Perhaps I wasn't being clear in my posts:
Greeeg wrote: I think most people use them intuitively
Which is why I want to use them for my class
However there is a difference between understanding:
string x = "hello world";
char y = x[0];
And being able to write:
this[int indexno]
{
get { return something; }
}
What I wanted to know was are people familiar with how to add this functionality to a class, rather then can people use a class which already has this functionality.
|
|
|
|
|
c2423 wrote: What I wanted to know was are people familiar with how to add this functionality to a class, rather then can people use a class which already has this functionality.
This totally depends on the experience of the developer
Experienced developers who have been programming with C# for quite a while will definitely know of their existence, while newcomers to C# probably miss them and go the GetXXX -way.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
When I first read "Indexer" I didn't know what you mean, but after seeing the example I realized you were talking about the [] operator. I think that almost every C++ developer might know that, as you can overload a lot of operators in C++ and it's something very useful.
BTW, the GetXXX method, is a method that connects to the internet and downloads adult contents from a porn site.
rotter
|
|
|
|
|
Thanks, exactly the answer I was looking for.
|
|
|
|
|
Again, not quite what I was looking for, but I think my question has been answered now anyway.
Thanks,
Chris
|
|
|
|
|
Hi folks! I have a project what I work on, and I have a local database. I am building a tool for cleaning the DB. The user can clean up the DB according to the selected date. The thing what I want to do is that the user can delete just files what are stored for more then 2 months. If the file is less then 2 months in the database then the user will not be able to delete the file. How can I do that? Any help, thx ahead
|
|
|
|
|
ru using SQL server??
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
Hi..
i Need to load all the available system colors and system brushes into the combobox, can any one help me...
regards
Vinayskvs
|
|
|
|
|
SystemColors , SystemBrushes , KnownColor
|
|
|
|
|
I can use System.Colors, system.KnownColor, etc but i need to populate the entire Systembush names in the dropdown list..
|
|
|
|
|
You have to use reflection (add using System.Reflection to top of file)
List<Color> webColours = new List<Color>();
foreach (PropertyInfo property in
(typeof(Color)).GetProperties(BindingFlags.Public | BindingFlags.Static))
{
Color colour = Color.FromName(property.Name);
webColours.Add(colour);
comboBox1.Items.Add(colour);
}
List<Color> systemColours = new List<Color>();
foreach (PropertyInfo property in
(typeof(SystemColors)).GetProperties(BindingFlags.Public | BindingFlags.Static))
{
Color colour = Color.FromName(property.Name);
systemColours.Add(colour);
comboBox2.Items.Add(colour);
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
how to convert string to SystemColors
|
|
|
|
|
It's in the snippet I gave you!
Color colour = Color.FromName(property.Name);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
this is fine with Colors but i need it for SystemColors..
please help me..
|
|
|
|
|
SystemColors are just Colors. The second half of the code gets those and populates the second comboBox.
MSDN[^]: Each property of the SystemColors class is a Color structure that is the color of a Windows display element.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
|
hi,
I have textbox and richtext box (asp.net)
I want drag text "{start}" from textbox then while dropping in the rich text it should display as "{start} Enter text {end}.
I want to implemnt in web applications(c#)
Can anybody help me to solve the issue.
thank you
Prabhakar
|
|
|
|
|
|
prabhkar272 wrote: I want to implemnt in web applications(c#)
You won't be implementing this in C#. You're intending to run this on a web page, so you will use JavaScript for this. There are many samples available, so just Google for drag drop javascript. BTW - it shouldn't be a RichTextBox you're using.
|
|
|
|
|
Hi,
Can anyone tell me if this is possible in a C# windows app.
I have a large gridview in C# but only a small amount of space to display this grid in.
What I want to do is change the background colour of a "header cell" to indicate any errors which may exist in the grid that may be out of view - this will help the user so they do not have to scroll up & down the grid to see any possible errors.
I have googled & googled & I still can't find out how to do this.
Any help would be great!
Thanks
Janet
Lady Programmers are a rare breed!
|
|
|
|