|
Can anyone give me an idea of what their learning curve was with C# for someone with a strong C++ background already? Thanks
|
|
|
|
|
Very short, really take a look at the material available online and you will see, it shouldn't take you too long.
-Nick Parker
|
|
|
|
|
C# as a language - very low. There a re a few nifties you should know before doing serious stuff - sitting down with a C# book for an afternoon or two should give you an idea.
However, you won't be able to capitalize much prior MFC / Win32 knowledge. If you e.g. plan to do some Windows Forms aplicaiton, it will be a little PITA to hunt around the namespaces to see which class implements the funcitonality you're looking for. (There's a namespace lookup tool with the SDK, it makes things much easier) However, once you're used to it, it's ok.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
peterchen wrote:
C# as a language - very low
Agree, as in its quick to learn, on the other hand the .NET Framework is big , I'm still finding new overlooked methods everday after a year now
I did a bit of Jaba before that, so it was is relatively easy.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Yep, as mentioned the learning curve for C# is not very bad although there is tons of "gotcha"s. After working with C# for about a year I just noticed today that you cannot use static variables in methods, that have to be defined in the class.
I would recommmed you look for a good book on C# from a C++ point of view.
The .NET Framework though is the roughest part. I think there is something like 8,000 classes in the .NET Framework. It is no wonder most people are still learning.
There is also a lot of programming concepts that change. I know I used to hesitate to break things up into DLLs. Too much hassle to use all the time. Now with .NET I often break up a program into many modules that allow me to work in a more componentized method.
One last point, with .NET there are so many ways to go about doing something that I find I spend more time trying to figure out the most logical choice. It might help to do some checking into the "best practices" for coding.
Opps.. Going one more.. Now that it is frowned upon to use hungarian notation, it becomes less clear on the proper way to label things. Most of the time it is like Java where you first letter caps except for the first word. But there are several different camps on style nowadays. Some still use "m_" prefixes for member variables while others have picked up a format that reminds me of the old assembler days where they prefix member variables with a single underscore (yuck). Some use the "this." to prefix member variables in usage (I think just so that they can use the intellisense ).
The road is good once you get past the pain of letter go
Rocky Moore <><
|
|
|
|
|
The style I use, which is (or was) adopted from MS's recommended style:
Uppercase first letter of each word on method names and properties.
camelCase* local variables and method arguments.
camelCase private member-variables in a class.
If you have an abbreviation, that would normally be all capitalized and it is only 2 or 3 letters long, then only the first letter gets capitalized (to fit in with MS's naming of the Sql* and OleDb* classes). I don't always follow this one, especially when I have something like CustomerID. Putting a lowercase 'd' there just looks wrong.
No m_ or _ for private variables.
Constants/readonly variables have uppercase first letter for each word.
*camelCase means to capitalize the first letter of each word, except the first, also Java style.
Rocky Moore wrote:
Some use the "this." to prefix member variables in usage (I think just so that they can use the intellisense ).
It depends, if you have a private member variable named myVariable and you need to use that variable in a method which has a local variable or argument, myVariable . To access the private member you need to prefix the name with this. otherwise you access the argument/local variable. Typically you see this with arguments because (to me) having a local variable of the same name just seems wrong.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
James T. Johnson wrote:
The style I use, which is (or was) adopted from MS's recommended style:
Well, a lot of code from Microsoft still has underlining. Seems many still are not with the program
This is the style I have used since I started but I have ran into a little problem with this though. If you have a private variable called "customerID" and you have a property called "CustomerID", when you build a contructor and pass in a varible, it looks off to have a parameter "customerID" and be forced to use the "this." in front of the member variable. That is the only I have found where some prefix on member variables could be a good thing.
One of my other pet peeves is that C# does not allow private variables at method level. I know it is not that big of thing to have them declared at class level and some people reason that it should be declared there to make it more obvious that it exists. Personally, I think the knowledge of the variable should only be at the method level, nothing outside the method should know or have access to the variable. But I understand that "static" does not quite mean the same thing as it did in our C++ world.
James T. Johnson wrote:
I don't always follow this one, especially when I have something like CustomerID. Putting a lowercase 'd' there just looks wrong.
I agree with that. I still use "customer_ID" in mine which is the only time I use an underline.
Rocky Moore <><
|
|
|
|
|
James T. Johnson wrote:
If you have an abbreviation, that would normally be all capitalized and it is only 2 or 3 letters long,
Actually, that only applies if it's three letters long like System.Xml
If it's two letters long, both are capitalized, like System.IO so your CustomerID is fine.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
Hi!
I wanna to build a flow chart program in c#. It is like a simpler IDE. The canvas contains the block (rectangle or circle), link shape, some buttons and lists. If these buttons and lists can make use of the control in dotnet, it will save us a lot time to simulate out ourselves. In the program's design time, user can draw the block and link them, drop the control of dotnet into the block. Adjust its position, size , change its title, and maybe assign some script of vbscript or jscript to the event like button's click. In run time, all element can't be moved, only the event are responsed.
Do you think it possible in dotnet? Is there any example or link to study?
|
|
|
|
|
|
hello,
is there any example shows the pictureBox drag&drop function.
I want to let user drag the picturebox within application.
but I don't know how to do.
Could anyone show me? thanks
|
|
|
|
|
I am having trouble of loading bitmap (contains 10 images) into the imagelist.
I have embedded toolbar strip (bitmap) into the form's resx file. (using Lutz Resourcer)
Now how to access the images stored in that bitmap?
When I go to the ImageList -> properties -> Images -> Collection -> Add ...
It asks for the image file again. How to tell ImageList that the bitmap image already included with the project?
How to retrieve these images at design time?
I have seen few samples where the bitmap's property RawFormat shows "MemoryBmp".
(NewB)
|
|
|
|
|
"When I go to the ImageList -> properties -> Images -> Collection -> Add ..."
if you used ImageList by load from resx file , you no need use its properties and if you do so you also never see iamges on list. Because it embedded all of images from resx file.
To get image from Imagelist you can do like this :
protected Bitmap GetImage(int ImageIndex)
{
return (Bitmap)imgList.Images[ImageIndex];
// imgList is Imagelist that you loaded.
}
If you want to see all of Images in List you can use IconSucker to load file resx then select index image depend on you.
.....
|
|
|
|
|
Hello!
In a listbox you can easily set the height of all items by
listbox.defaultItemheight.
Is it possible to change the itemheight in listview, too?
hope, u can help me.
Hurlie
|
|
|
|
|
If I have a string that has null characters at the end, how can I remove them?
Doing Trim('\0') didn't work and I can't think of anything else to try, besides manually finding the position of the last non-null character and then removing everything after it or something like that.
|
|
|
|
|
r u using CString?
Nuno Henrique Mendes
|
|
|
|
|
ThemRight()? You mean TrimEnd()? None of the trim functions worked.
|
|
|
|
|
Trim trims spaces not anything else. If you want to trim
other chars you need to use the Trim( new char[]{' ', '\0'} );
or what ever you need. TrimEnd( new char[]{' ', '\0'} );
TrimStart( new char[]{' ', '\0'} );
|
|
|
|
|
Yees, but as I thought I said, it didn't work.
|
|
|
|
|
string str;<br />
byte [] charStr = new byte[] {(byte)'T', (byte)'e', (byte)'s', (byte)'t', 0, 0, 0, 0, 0, 0};<br />
str = Encoding.ASCII.GetString(charStr);<br />
<br />
str = str.TrimEnd(new char[]{'\0'});<br />
This code works. Make sure you are assigning the return value of TrimEnd method to your string. It does not actually trim the contents of string object but rather generates a new trimmed string.
|
|
|
|
|
After looking at docs, this is even better:
<br />
str = str.TrimEnd('\0');<br />
Also, if you are reading a null terminated string, there is a chance you have garbage characters after the terminating null. This will prevent Trim methods from working. So, your best approach would be:
<br />
int Index = str.IndexOf('\0');<br />
if (Index >= 0)<br />
str = str.Substring(0, Index);<br />
|
|
|
|
|
can someone tell me how can i get a DataSet and put it into a RecordSet?
if u know this please help me.
thanks
Nuno Henrique Mendes
|
|
|
|
|
I wrote a windows application using threads. There is some images is in my main form. Form was working well. Then i added a delegate to add controls to main form from another thread. Like this:
using System.Xml;
using System.Threading;
delegate void AddTabPage( string strUniqueID );
namespace ggg
But now, i get a runtime error like this:
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "Form_OperatorMain.resources" was correctly embedded or linked into assembly "SupportAliveOperator".
baseName: Form_OperatorMain locationInfo: SupportAliveOperator.Form_OperatorMain resource file name: Form_OperatorMain.resources assembly: SupportAliveOperator, Version=1.0.1238.30259, Culture=neutral, PublicKeyToken=null
can anyone help me?
thanks..
|
|
|
|
|
how can i put an icon in a menu item
thanks
Nuno Henrique Mendes
|
|
|
|
|
You can't do it using standart .Net menu, but you can use this cool library[^].
(Menus with icons, floating dockable panels etc..)
i'm only pointer to myself
|
|
|
|