|
The problem is, they want C# to be idiot proof. They are more worried about how it can be misused, than concerned about how it would be used in the right hands. The switch statement is ample proof of this. As is generics. Both watered down versions of stuff that C++ allows to do so much more.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I think having .NET as multi-language and interoperable was a design consideration. Though Eiffel managed to retain MI and still work and be interoperable on .NET.
|
|
|
|
|
I think it was a bug in the design and later they could not change it , many times I was really pissed when I tried to do.
switch(var)
{
case A:
do A;
case B:
do B;
break;
}
And it doesn't compile.
|
|
|
|
|
It's not a 'bug', it was a deliberate decision to make C# easier to use ( because there's no way to accidentally fall through ). As an MVP, I've been in a position to talk to the language designers, that's what they told me.
I love C#, but I am also very much opposed to their design philosophies. They amount to telling me I am an idiot.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Wow that's cool, you had the chance to talk with the language designers.
I guess that was a wonderful experience which I don't mind if you want to share.
|
|
|
|
|
I also think that it's nuts to include an unsafe keyword in a supposedly-bulletproof language.
And as it comes up so often, I'd also like to see a simple keyword-based way of creating this kind of code:
public int Day{
get {
return day;
}
set {
day = value;
}
}
int day;
|
|
|
|
|
type in 'prop' and hit tab twice?? (VS2005)
Dave
|
|
|
|
|
You live and learn.
|
|
|
|
|
You can do that with refactoring, (couple clicks).
Right click on the variable declaration and => Refactor => Encapsulate Field
also could be nice if C# could do something like this;
public class a
{
private int mDay;
public property Day(mDay);
or
public property Day mDay;
or more directly in the declaration
private int mDay public property Day;
private int mDay expose public Day;
}
|
|
|
|
|
But that defeats the whole purpose. To be honest, when you're just writing public set/get methods, I think it's stupid to even bother with a property. It's just a waste of time.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yep, but I really dislike to make a private member as public.
I like to call my member with mXXX which in that case If I do that then my object will expose a variable mXXX which looks pretty bad.
Ofcourse as you know having a wrapper property to expose a variable allows you to expand the code behavior in the future and then the interface won't need to be changed as for example raise an event when the variable gets changed.
C# has many things that allows you to save code, if could exist something as I mention before, later if it needs to be expanded then replace the property declaration with a property body, so the property signature won't change.
In fact the compiler could detect a property declaration and replace it for a public/internal variable at compilation time, that could optimize the code too as long the property doesn't have a body.
Same case for example with anonymous methods, they allow you to save code and calls, but many people think they are ugly, but anyway they are there.
|
|
|
|
|
For most applications, having public fields is no problem. Don't blindly trust every FxCop rule.
Only if you require binary compatibility between versions of your library, you shouldn't have any public fields - not because there is any problems with public fields, but because you later might want to add raising an event to the setter and thus need a property.
What I really would like to see is a way to create attributes/something else that transforms the source code before compiling - so I could create my own way of generating repetitive code (e.g. for properties). Something like http://www.postsharp.org/, but it would have to run while compiling - before doesn't work because I would like to have type information available, after doesn't work because then I couldn't simply access the generated members.
|
|
|
|
|
|
messages wrote: maybe C# is difficult than C++),
Wrong
messages wrote: however C# almost like C++
Totally wrong. C# is like Java, it's nothing like C++
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
A 5 from me
Roswell
"Angelinos -- excuse me. There will be civility today." Antonio VillaRaigosa City Mayor, Los Angeles, CA
|
|
|
|
|
That is not at all true..... You say you know C++, and by that, i assume you have a fair to good level of grasp of the concepts of programming (not specialized to any one language). You're already halfway through....
I consider VC#.NET as one of the quickest languages to learn...all you need is the following:
- MSDN Library (preferably working inline to the Visual Studio IDE)
- Visual Studio IDE (though other IDEs like Sharpdevelop are good too, but I think MSDN is best integrated with Visual Studio IDE)
- A (preferably non-ending supply of) cup of coffee [optional];)
- A zeal to learn something easy, compared to the message maps and pointer stuffs under C++.
Also DO NOT avoid the temptations to start away with the Windows Form controls, instead of hanging around console applications like some of the tutorials suggest you to do.....Trust me, completing a Win32 Form in C# gives a sense of satisfaction matched by nothing else
|
|
|
|
|
Probably the best way to learn is to actually try coding something - pick a simple project (something GUI based, as this is somewhere .NET really shines compared with MFC) and get coding. Don't worry if you're writing dodgy code, just keep reviewing what you've written when you learn new stuff, and you'll soon get used to it.
|
|
|
|
|
benjymous wrote: Probably the best way to learn is to actually try coding something
probably. but u wont get a chance to *learn* new things that way. u tend to code in same old way. So read-and-code should be the better way.
|
|
|
|
|
The formula of success:
knowledge = (read * 2) + (codе * infinity);
Strahil Shorgov
|
|
|
|
|
Strahil wrote: knowledge = (read * 2) + (codе * infinity);
wrong;P. As per your formula, if code = 0 then knowledge becomes (read *2). So it means "if u don't code but read twice, u will acquire knowledge", which is false.
|
|
|
|
|
|
Pravarakhya wrote: Strahil wrote:
knowledge = (read * 2) + (codе * infinity);
wrong. As per your formula, if code = 0 then knowledge becomes (read *2).
Wrong.
0 * infinity = undefined.
read * 2 + undefined = undefined.
So it means "if u don't code but read twice, strange things can happen"
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
There is a piece of true hire, but:
0 * everithing can stends here = 0
It meens "no code no knowledge, mo' problems - only wastе of time"
Strahil Shorgov
|
|
|
|
|
Hi,
I would say just think about some practical Windows application that you could build, for example an application to organise the cd's and dvd' you have at home.
Normally information (of any aplication) is stored in some form, it could be a text file an xml file or a data base, but for a sample application i would chooce a database such as Access or Sql and think about what tables you need for your this application, for example:
Item (cd/dvd information)
Artist (artist information)
Band (band information)
Genre (Music Genre information, rock,jazz,hip-hop, r&b etc)
Friend (friend information if you lend cd's dvd's to someone)
Track (Track information to hold the track information of your cd's dvd's)
When you have created the database and the tables you need you have the storage you need and could start building the menu items and screens you think your application should provide to the user.
For example you have a genre table, so a screen to view the genres you have, and to add, edit or delete the table data would be nice etc.
Basically it comes down about building the screens and adding controls to them to visualise what you would like to have ,including the options the sceens should provide to the user, and the data that should be shown there.
Since you allready have the database written you are at the point of making data visible on the sreens by connecting to the database and loading the data and creating the methods to make it work.
Just building a sample application like this is still a lot of work but the nice thing is that you end up with an application that is what you wanted to build and that is the first real kick when you end up with just that.
You will find that you have to read a lot about creating tables, connecting to the database, getting menu's working, etc etc and that you learn a lot during the building of this.
After this you have a basic idea how it works and it could be nice to make this application available in a website with the same functionalitty and there you go using the same database to try to get this done in C# and Asp.Net
I know that suggesing building this sample doensn't say much about using classes etc etc but you will notice while building and reading samples and searching for way's to make it work you find information and get idea's and will start use all of that also.
-- modified at 8:36 Thursday 15th February, 2007
With friendly greetings,
Eric Goedhart
Interbritt
|
|
|
|
|
I'd suggest you get "Learn C# in 24 Days" from Sams as a basic reference and use CP Articles to share others' experience, BTW: dont be sad for getting low score for your post, I believe it is your English.
Cheers
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|