|
1.0.5000.0 (.NET 1.0 SP2)
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
leppie wrote:
An abstract class may not be constructed, so why do you need to provide a constructor?
If you don't provide one at all (and alter the C# compiler to not provide one for you) you can't inherit from it to make use of the abstract class.
We can infer that because combining abstract with sealed results in an error that the C# desigers want the abstract keyword to imply that you want the class to be inherited from at some point.
It is perfectly legal to have a private constructor on an abstract class, which if all constructors are private then the class can't be inherited from.
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
|
|
|
|
|
leppie wrote:
1. Why cant you have a "params" parameter for the constructor of an attribute?
You can. I've been doing it in our app for over a year (soon after the 1.0 release was released; never tried it before that). The following should work:
public class MyAttributeAttribute : Attribute
{
private string[] parms;
public MyAttributeAttribute(params string[] parms)
{
this.parms = parms;
}
}
It works for me. Perhaps a code snippet would help.
leppie wrote:
2. Why do you have to provide a constructor in an inherited abstract class where the base class does not have a default constructor?
Just to clarify, is the abstract class being inherited, or does it inherit from another class? If the latter is the case, is the base class also abstract?
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
|
|
|
Nope, that's how we do it at work, using String s and everything. The code snippet I gave before is the syntax I used. Is this in .NET 1.0 or 1.1, BTW?
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
|
Anybody got any ideas to show a tooltip anywhere on the screen, not attached to a control? I tried converting this article, but something must of gone wrong because it doesnt work
| Website: http://www.onyeyiri.co.uk
| Sonork: 100.21142 : TheEclypse
| "If a dolar was a chicken would the chicken be evil?"
|
|
|
|
|
Did you have a problem with the struct or something else?
-Nick Parker
|
|
|
|
|
i have fixed it now, i forgot to add the structlayout attribute to my definition of RECT, and i used long instead of int. thanks for replying though
| Website: http://www.onyeyiri.co.uk
| Sonork: 100.21142 : TheEclypse
| "If a dolar was a chicken would the chicken be evil?"
|
|
|
|
|
I am trying to implement a web service that uses client and server certificates - the problem is, this has to be transparent to the user. Has anyone seen any code examples of how to accept the ssl server-side certificate programatically? We do not want to put this in the client store - we want the code to just accept the certificate, so the user would not have to.
Thanks in advance!
Jeff Phillips
|
|
|
|
|
If you're just doing secure communications between client and server, you don't need to put a certificate in the code store. General, the root CA has to be in there for the certificate to be accepted, but if it is and it is trusted, the client will accept it.
Now, if this is a distribution app in which certificates are installed, current implementations of the CSPs in 2000 and XP require a user's confirmation. I've seen nothing to the contrary mentioned in the documentation. Think about the ramafications: if a client trusts a certificate that is signed by a CA already in their store (put there by a worm, for example) then a signed, malicious ActiveX control or Java applet could get nasty! Not a very secure approach, is it?
For this reason, users are notified when their store is being accessed or at least if it is being changed. I have mine configured to let me know when something is accessing my private key so I know when its being used. There's no documented way (and hopefully no way at all) for this to occur programmatically, otherwise something could be faking messages from me that are signed and valid.
As far as secure communications go (ex, HTTPS), this should all be transparent. If you need to first distribute a self-signed CA (one your company generated), distribute it manually or through your Certificate Server (assuming you're running it and have ActiveDirectory). Once the certificate is installed successfully (implies a user's trust), you shouldn't have a problem doing secure communications.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
In my solution, I have two projects, lets call them A and B. Project A references project B and includes a namespace from project B in one of project A's classes. When I try to compile the solution, I get an error saying that the namespace that I am including in project A cannot be found. If I reboot my computer, it will compile the solution fine. However, if I make any changes to project B, project A will not see project B until I have to reboot my computer again. Does anyone have any suggestions because it is getting a little annoying having to reboot every 20 minutes? Thanks
Shaun
|
|
|
|
|
Did you add a Project refence of B to A, or a file reference? You should use a Project refernece because that sets-up a dependency. To compile A, B must compile. If B compiles successfully, it is automatically copied to project A's obj and bin subdirectories (and into Debug or Release subdirs appropriate). A file reference won't work this way.
Also, if B doesn't compile successfully, A will still try to compile but will fail because B doesn't exist in its private path (the obj and bin subdirs). The file must be in the same directory (during build-time; there are ways to override this at runtime) or in the Global Assembly Cache. When B starts to compile, the other B.dll assemblies are deleted.
This may explain what is happening, although I don't know how the reboot fits into this.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Yes, I had a reference to B from A. B compiled fine and then A would try to compile and it would say that it can't see a namespace from project B. Now rebooting doesn't even work anymore. I have to delete the reference to B in A and then re-add it and then save it, close out the IDE and then re-open the IDE for it to compile.
|
|
|
|
|
As long as the reference is a project reference and not a file reference, then I don't know. Are you current with services packs for the IDE? Perhaps reinstalling is necessary.
Oh, do you ever get errors or warnings about B's assembly being in use (or the PDB file in debug builds)? We get this error sometimes here and you just have to kill the open handle. Often, this means restarting the IDE (updating the project reference isn't necessary). This typically happens if you run your app and either leave it running or stop it while debugging. Pieces stay in use.
Just a thought. Good luck!
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
I am up to date on all my service packs. But yes I was getting that error. Originally, I had all my projects outputted in the same bin directory. Then I started getting that error and so I changed the output for project B to be its local bin directory and it seemed to solve it. Thanks for your help though.
|
|
|
|
|
For one program I am converting to C# from C++, there are many large struct arrays. The struct itself is made up of six or seven numerical values, but there are approx. 20,000 of them. A program will automatically generate the file, but I do not know how to store it. Originally, the program generated a large .cpp file, so, ideally, it would generate a .cs file. Unfortunately, C# does not appear to have a similar feature.
Some formats I have considered are:
1) Serialized array of the structs, either as an external file or as an embedded resource. This is far from ideal, because serialization stores the assembly, version, and type name from which it was created. For reasons that are hard to explain, storing this data will render the file unusable.
2) XML Serialization: this is out. For such a large file, it is a very verbose file format.
3) Reading/writing structs in C# (as in fread/fwrite), with the file as an embedded resource or as an external file. The code that I wrote to do this is probably not very efficient, and for 20,000 structs, efficiency is a big concern.
4) This may seem a little weird: data segments in IL. It might be possible to generate a .il file that contains a ".data" section which contains the raw data of an array of structs. Is this even possible?
Anyway, if anyone has any suggestions, questions, or comments on what to do, please let me know. There may be something that I am missing.
Thanks.
PS. It is very early in the morning for me. If I do not make any sense, that is why
|
|
|
|
|
Why convert the program to C# if it is large? Use MC++ instead and take advantage of both worlds (managed and unmanaged) without being seen.
|
|
|
|
|
I thought of that. However, it is not ideal. The program might have to be run from a network share (untrusted source) and MC++ will fail this if it has any native code (AFAIK).
The real reason: the managers want it in C#
|
|
|
|
|
>> and MC++ will fail this if it has any native code
C# code will also fail if you use [DllImport] and the client machine has not checked "allow untrusted source code execution" from the .NET config panel.
|
|
|
|
|
I figured out something with serialization. I was missing something very obvious, so now serialization will work for me. Thanks for helping.
|
|
|
|
|
Hello,
When playing with the webbrowser control I realized two
things:
- If I call Navigate("about:blank"...) and the line after
Navigate("http://www.test.com/"...), the first
call 'about:blank' never fire a
beforeNavigate2,NavigateComplete and DocumentComplete
events and the webbrowser is not loaded with the blank
page. Of course the second call properly load the page
and all events are fired. How is it possible to make sure
that both Navigate calls are going to work ?
- When I use Webbrowser.Stop() it seems that it doesn't
prevent the browser to continue loading parts of the page
and fire Before,Complete & so on events. Maybe the
problem is related to the other because I try to call
first Webbrowser.Stop() and I call Navigate
("about:blank"...) the line after to empty the
Webbrowser. I'm not sure the WebBrowser.Stop() is
executed but the second call "about:blank" fire
before,complete & so on events and works. How is it
possible to make that the Webbrowser.Stop() call works ?
And if Stop() doesn't do it, how is it possible to
prevent the load of parts of the page ?
Any help will be greatly welcome,
R. LOPES
Just programmer.
|
|
|
|
|
Because of the multi-threaded nature of IE, the WebBrowser.Stop() method doesn't work well. Multiple framed pages only worsen the situation. In fact, the navigation toolbar does not work as soon as you have more than one frame in the web page.
I believe that you can't stop the loading of a page once it's started. It's really up to you to filter out the html code by having it loaded separately and ask IE to process it.
|
|
|
|