|
|
I only recently changed to C# but was not even aware of the IDE capability, then again I am continually amazed at the shortcuts that I don't know of. Just vetting the way another programmer does their work reveals little insights all the time.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So, not like the alphabetical list at the top of the Properties pane? Which I hardly ever use?
|
|
|
|
|
I finally got around to creating a WinForms solution (VS2008) in VB.net and I don't see what you're talking about -- it looks pretty much the same as a C# solution; except C# solutions/projects don't hide files from me.
|
|
|
|
|
if it is a WinForm project, add some Controls to the Form, and they appear in the drop-down at the top left of the edit window in VB.NET, they don't in C# (I'm using Express Editions here).
VB.NET Express hides files by default, clicking one of the buttons above the solution pane remedies that.
|
|
|
|
|
Luc Pattyn wrote: add some Controls to the Form
Yep, did that.
Luc Pattyn wrote: and they appear in the drop-down at the top left of the edit window in VB.NET
I don't see it... ohhh... that. I don't usually have the Navigation Bar (never heard of it before now) turned on in C#; it seems fairly pointless, trying it on for size now. Yeah pointless, only useful if you define multiple classes in one file -- which you shouldn't do.
And they don't let you turn off the Navigation Bar in VB?!
|
|
|
|
|
I typically have only one class in a file, and I only use the righthand drop-down, which lists methods and properties. That is quite useful IMO.
I don't remember having ever changed the setting about nav bars, and they are present for me both in VB.NET and C# (Express!)
|
|
|
|
|
I guess you can't blame the language. If the C# editor lacks some features, you should blame the editor. Both languages are different, with pros and cons. I prefer C# for almost everything, but I still use VB for some very concrete things which result easier than in C#.
|
|
|
|
|
Agreed... I have no problems with C#. I use it all the time. I just am aggravated with the inconsistencies of the editor. It’s not the languages fault, and I didn’t intend for it to sound like that.
See my reply below to PIEBALDconsult about what I am really ticked at here…
|
|
|
|
|
Ray Cassick wrote: get the shell of the code built for you
Either by double-clicking the control in the designer or by selecting an event from the properties pane.
|
|
|
|
|
Yeah, now see... that to me is an oddity...
Just double-clicking in the control provides you with a default event handler (in all honesty just like the VB editor does the same thing) but to get a handler for a different event you need to then go over to where the properties window is, select the button to display the events available, find the event type you want in the list and click it to see it.
Yes, I agree that you CAN ALSO do the same thing in a VB project.
I am just aggravated that for a company that tries to preach visual and usability consistency in their documentation, they go and do this. They made the UI for a C# code editor window and a VB code editor window behave in different ways.
WHY?
Trust me, I am in no way slamming C#. I LIKE the language. It’s fine for when I use it, and it gets the job done. YES, my first choice is to use VB if I can, JUST because I am used to it over the years, but I can play in both areas just fine code/concept wise.
It just aggravates me that in this day and age MS is still not following their design philosophies.
Surprised? No.
Aggravated? Yes.
Something as basic as the organization of a code editor window, in my opinion, should be a standard that the developers HAVE to follow. It would be stupid to expect a VB developer to use Ctrl+C for the copy command and then expect the C# developer to use a different command right? In fact it is against every tenant that MS establishes, but they STILL allow this kind of junk to happen within their own development teams.
Maybe the C# devs feel the ‘VB way’ of doing it is stupid or childish, or inefficient, or whatever, but the simple fact is that MS obviously little control over what their devs implement and this shows it. Here we are, VS2010 and we still see creepy differences like this.
I wonder if Eclipse or SharpDevelop have inconsistencies like this?
|
|
|
|
|
publc class Thing
{
Thing () {}
public List<Foo> MyFoos {get; set;}
}
<pre>
How do you get the list to be defaulted to an empty list rather than null? Do I need to implement a private backing variable?
|
|
|
|
|
Either use a backing field and lazy initialization
public class Thing
{
private List<Foo> m_List;
Thing() { }
public List<Foo> MyFoos
{
get
{
if(m_List == null)
m_List = new List<Foo>();
return m_List;
}
set{ m_List = value; }
}
or use the constructor
public class Thing
{
Thing()
{
MyFoos = new List<Foo>();
}
public List<Foo> MyFoos {get; set;}
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Excellent answer... (Because I do it this way, of course.)
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Do you have to do it in every constructor? I put it in the default constructor but it doesn't seem to work when I instatiate using a different constructor.
|
|
|
|
|
You need to append :basename() to the constructor definitions.
public class MySuperAwesomeClass
{
public int AwesomeOne { get; set; }
public int NotAsAwesome { get; set; }
public string UselessCrap { get; set; }
public MySuperAwesomeClass()
{
AwesomeOne = 42;
NotAsAwesome = -1;
}
public MySuperAwesomeClass( string someValue ) : base()
{
UselessCrap = someValue;
}
}
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Appending :base() doesn't run the default constructor for that class. The debugger never enters the default constructor and all my list properties are still null if I instantiate using a different constructor.
|
|
|
|
|
Rather than append :base() , you should use :this() to call the default constructor in the current class. The use of base implies a call to a base class, whereas this refers to the current class.
|
|
|
|
|
Not quite. I suspect you're thinking of :this() instead.
|
|
|
|
|
Or initialize it in the constructor
--edit
What Mark said!
I are Troll
|
|
|
|
|
I want to ask if you used a wizard control on windows form? which one your recommend?
|
|
|
|
|
I always make my own using panels and a little bit of logic - not very difficult and much simpler than trying to manipulate some pre-existing control to fit my needs.
|
|
|
|
|
Thanks I did the same and it's fine now
|
|
|
|
|
I am currenctly using the AdRotator control on C# WinForm with AdvertismentFile but I want to make a use of mySQL and use it as source for my banner by selecting random banner from the database..
my question how can i set and use the Impressions?
|
|
|
|
|
Hello friends,
I need to create a application which sholud pop up near system tray(like skype or g-talk etc), can any one help me how to do this or any links or samples, I googled enough for the day, let me know any thing with u also guys?.
Thanks in Advance
|
|
|
|