You raise an interesting point on readability. Languages always seem to start with ease of use and straigtforward readability as the dominant forces, and then move to power over time, but perhaps the languages never really target simplicity at the beginning; simplicity happens at first because...
Now that you see from the postings above that C# requires direct method calls instead of cin >> x style programming, you may wonder why nobody has ported this C++ chestnut to C#. One part of the answer is that differences between overloading in C++ and C# would make porting that particular C++...
Thanks Chiph,
That is an interesting article. At first the restrictions on generics (compared to C++) seem to make generics almost useless, but then when you see the new
where T : IComparable
style syntax, things exapand back into usefullness.
It seems like a better solution than the looser...
Matt,
No, you are not "going mad", although it can seem that way when something that was working one day stops working the next. There is something changing on you, but it isn't your sanity.
Adding to the confusion, the cast problem very well could be on the string column. It isn't...
ArrayList knows how to work with any ICollection. Arrays don't show all of their interface based methods (to simplify working with them with intellisense in the IDE) but they support all of the collection oriented interfaces that make sense for arrays. ICollection is supported by all arrays...
Here are two method:
1) Environment.GetCommandLineArgs() returns an array containing all of the command line arguments. The first argument in this array is the canonical path to the application. No matter how the application is started ("..\myApp", "debug\myApp", etc.) the...
There is a member that allows it, but what might be surprising at first is that it isn't a method, but a property.
Set "Length" to zero. Length is writeable in the StringBuilder class. The internal buffer will be untouched (which is good for performance), and subsequent...
Languages have now borrowed so much from each other that the key abstractions – good support for components, convenient access to the operating system API, object oriented programming as the primary abstraction, and support for threading, networking (in its various forms), and GUI development –...
The program would work, but I'll bet you a dollar you have an extra line at the end of your "records.txt" file that is causing this problem. Make sure the fields are seperated by tabs, and the last line of text is also the last line of the text file. (In notepad for instance, hitting...
If you put this
using ServiceClass = service.ServiceClass;
at the top of your program, you can then say
ServiceClass sc = new ServiceClass()
inside of DatabaseClass.
Yes, you can. Note that namespaces are all or nothing:
1) You can't start in the middle when using a namespace, for instance you can't say "Collections.ArrayList" in an application that has declared "using System;".
2) Sub namespaces under a namespace are not included for...
In a proper implementation of delegation you can expose a subset of interfaces on the inner object. You have a bug in your code in the aggregated (inner) class. You should *not* be able to get I2 directly from the inner class I1 via QueryInterface.
Your inner component is supposed to be...
I don't know if this will be good news or bad news, but after finding nothing wrong with a quick desk check, I ran your program on my machine and it ran fine. After pressing "a" a bunch of times I had a zoo of multi-colored happy faces bouncing around in the console. I pressed...
Yes, you missed a trick, but fortunately it is a really easy one. You just need to add a reference to the System.Management component.
You probably know how to add a reference, but just in case, here are the detailed directions for adding the reference you need from within the IDE.
1) Right...
The postings already up have covered the main topics, so here are some of the code level differences between the two:
C# has operator overloading, like C++; VB.Net doesn't.
C# allows "unsafe" code blocks with raw pointers (like C/C++ pointers); VB.Net doesn't
Late binding is easy in...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.