|
C++ - C# (Win32)
----------------
int = int
long = int
__int64 = long
DWORD = uint
Regards,
Alvaro
He who laughs last, thinks slowest.
|
|
|
|
|
Actually, be careful with uint . It's not CLS-compliant and you should try to avoid those. I have almost always used int for DWORD with absolutely no problems. Microsoft does the same throughout the BCL, too. While DWORD 's can't be negative, the bit representation is still the same so even passing a negative int to a DWORD in some native function works.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
It's not CLS-compliant and you should try to avoid those.
as long as it is not publicly accessable, iow locals, private fields.
one should always use the correct type though, although int will probably work 31/32 times
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
leppie wrote:
although int will probably work 31/32 times
Exactly! As I was saying, though, this usually isn't a problem. The biggest reason I typically use int is because Microsoft does in their BCL. Since they wrote the .NET Framework, seems reasonable to me. Of course, I guess worrying about CLS-compliancy is pretty moot if you're using a uint to P/Invoke a native call, huh?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Using Windows XP explorer I just tried to search for some words that I know are in comments within some of my .cs files. All the searches turned up empty! I double checked the directory and the spelling. I checked all of the options to be sure case or some other setting was not the issue. Anyone seen this, know why it doesn't work, or what I might be doing wrong?
>>>-----> MikeO
|
|
|
|
|
Check the Index Server catelog, System, to make sure it indexes files with unknown extensions (you can get to this from the Computer Management MMC snap-in, or by right-clicking on My Computer and clicking Manage).
Also, the Index Server does not index files immediately. It catelogs at certain times, usually when your computer is idle. It doesn't happen immediately.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I thought the file searching features were just buggy. I was close to having a hit put out on that little wizard guy and his puppy dog friend . I had no idea...
I resorted to installing Cygwin32 just so I could use grep.
Any idea how bad the perfomance hit is to have this service constantly indexing all file types (I assume this goes on in the background constantly)?
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
As I said, the Indexing Service runs when your computer is idle. To see this in action, see the Indexing Service snap-in. Clicking on the root node will show you the stats and status for each catalog.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I've been digging throught my large stack of C# books in an effort to find some information on how to get multiple source files to work together and haven't found anything usefull.
For instance, it seems reasonable to me to place a function call in the event handler and place this function (method) in some other file. My knee-jerk reaction is to make a header file but that doesn't fly here.
What keyword do I need to search for? I've looked under scope, modules, visibility, and assemblies and somehow keep missing it.
Are all the static methods global within an assembly?
Is this good practice?
Thanks
Ken Galer
Electrical Engineer
Preferred Utilities Corp.
Danbury, CT 06810
|
|
|
|
|
in this version of c# all parts of a class must be in one file.
in the next version you will be able to split the code up using "Partial Types"...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Thank you!
Ken Galer
Electrical Engineer
Preferred Utilities Corp.
Danbury, CT 06810
|
|
|
|
|
Philip Fitzsimons wrote:
in this version of c# all parts of a class must be in one file.
But this doesn't mean that you can't define non-class dependant enum s, delegate s, etc... somewhere else.
And, if you want to split members into several files to make things more organizable, then you might as well take a look at the #region [^] preprocessor directive. In VS.NET and SharpDevelop, you can expand and collapse the code between two #region and #endregion directives.
- Daniël Pelsmaeker
"Let others praise ancient times; I am glad I was born in these."
- Ovid (43 BC-AD 17) Roman poet
|
|
|
|
|
Why does it seem reasonable to please the method that the event handler calls in another file? If the method is on the class that has the event handler, just call it. If it belongs to another class, make sure the class with the event handler has a reference to that class (unless it's a static method) and then call it on that object (or Type if it's a static method). This is just practical and common object oriented programming.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
Why does it seem reasonable to please the method that the event handler calls in another file?
I'm thinking of a case where the event is caused by a menu selection and that the same code would be run by other events such as a context menu, a toolbar button, or a drag-n-drop. If all these events could just call the same method, this would just be a way to keep things clean and obvious. I realize (now) that this could be a private method in the class.
I was thinking a different file because it seems to me (based on very limited experence) that the file size is getting rather large. Just considering the stuff that handles the controls and events, etc. is large enough but if you also include the many different methods (that could be many pages long) called by the events it could get VERY large, hard to navigate, and slow down the build.
I'm not sure if I'm being clear. As I buld my the applcation and add more functionality it usually consists of adding another event in form1.cs and adding code for the event. If form1 is the main form for a large project it's easy to imagine 50-100 events and associated code. GASP!
Should I just not worry about it and make use of the methods dropdown box in VS and #region attributes or make some attempt at breaking the code into more managable files? Is is normal to have these large code files in C# projects?
I may be stuck in C thinking mode.
Thanks,
Ken Galer
Electrical Engineer
Preferred Utilities Corp.
Danbury, CT 06810
|
|
|
|
|
The size of the source file doesn't matter. It's the size of the compiled Type, but this really isn't an issue, either. The only thing that dictates how big an instance of that Type is (an object) is the fields that are holding data. The System.Windows.Forms.Control Type is huge, for example, but an instance of one really would be that big at all.
Yeah, using #region s effectively is a good idea. I use them a lot and they definitely help, as does the member bar at the top of the source file window.
The partial classes mention elsewhere in this thread can help this problem, but it really doesn't matter. The main reason for partial classes is for the Avalon presentation layer in Longhorn, where part of the class is defined by XAML, and part of the class is defined in the code-behind file, almost like in ASP.NET except the .aspx file is actually compiled at run-time into a class that derives from your code-behind class, which derives from System.Web.UI.Page (the same concept is true for .ascx files as well). That's just derivitive classes, though, not partial classes.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How can I serialize System.Web.UI.WebControls.Unit class?
I have web control's properties stored in session and I need them serializable. Any suggestions?
|
|
|
|
|
You can either use an ISerializationSurrogate along with your serialization formatter, or have the parent serialize and deserialize he struct's members and don't serialize the struct itself.
How are you serializating this? That might help answer your question a little better.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ok with the help of this list I am getting somewhere with interfaces... But I have a little trouble with the C#/.NET reference documentation.
My question
What does the Type.GetInterface Method return if the type does not have the requested interface. The .NET documentation does not specify this in the methods documentation?
Thanks for helping
I am a bit green to this environment but I am getting there quickly with this site/list.
|
|
|
|
|
Return Value
A Type object representing the interface with the specified name, implemented or inherited by the current Type, if found; otherwise, a null reference (Nothing in Visual Basic).
...straight form the Type.GetInterface documentation. As a norm, methods that return reference types typically return null in cases like this, or just throw an exception if there's an error.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
How can I clean the console in a C# console application ?
(juste like the cls dos command).
Regards,
Matthieu
|
|
|
|
|
Yep, Microsoft haven't included one method to do this on the Console class,
you can find some Console extended clas if you search, i don't try that.
Luck!
----------------------------------------------------
Q no seas un paranoico no quiere decir q nadie no te persiga
|
|
|
|
|
I want to extend then .net framewok's usercontrol,to make it has a showdialog like windows forms. How Can i get it???
Thanks a lot!!
|
|
|
|
|
Just like you would do it when not working on an UserControl :
MainForm frm = new MainForm();
frm.ShowDialog(this);
|
|
|
|
|
Hi! I think you maybe mistake what i said! I mean the UserControl has the ShowDialog() method acts as the showdialog() method of the window forms. For example,there is a userControl instance: "usercontrol1",When I click a button,I call The usercontrol1's method usercontrol1.Showdialog(),and the usercontrol1 will be showed just like we show a Form instance with then showdialog() method.
|
|
|
|
|
Even I'm confused(not unusal). You want usercontrol1 to call showdialog on itself What's the point?
|
|
|
|