|
mschuckmann wrote: the immediate base of class3 is class2 not class1
That is easily fixed by adding a new basePrint() at each level
mschuckmann wrote: pollute their code
I agree completely; now if its only for one method (Serialize) one might choose to live
with it, lacking an alternative in the given context.
|
|
|
|
|
|
+ if you want to call print from class1 you should use this syntax:
((class1)b).print();
where class1 is the base class.
|
|
|
|
|
Hi Matt !
I think you cant:
1.
if you have a Base object or a Base-derivative pointed to by a Base reference,
it will do the virtual call, as intended by the virtual keyword.
2.
there is the "base" keyword, but its use is restricted (see paragraph 7.5.8 in the C# ref man)
to a few places, all inside classes that derive from the base class.
So yoy cant do myObject.base.methodname()
Conclusion: the virtual stuff really hides the base methods/properties.
And my first impression is that is how it should be.
Why is it you want to get at the base implementation from outside of the class anyway ?
There is of course a trick to do it, by providing a Clone() method in the base class,
something that takes a Base or Base-derivative and creates a new Base object, equivalent
to the base-part of the object (similar to a copy constructor), stripping off all
specialization.
|
|
|
|
|
Thanks for the reply and that's pretty much what I thought that you can't.
This kind of came up from a friend of mine who is trying to impliment something like the boost serialization library in C# in that he has a secondary class that is walking the inheritance tree of the class to serialize by exlicitly serializing the base classes states. It kind of does this in a funny way and I'm not entirely convinced it's the right way.
Beyond that I have run into times where it was handy to do this, usually because something beyond my control was implimented improperly.
|
|
|
|
|
I see; in the mean time PIEBALDconsult has come up with a good approach that may well
fit your needs.
|
|
|
|
|
|
Sorry
with a spoonful of lateral thinking I read your sentence "Note that it is possible to invoke the hidden virtual method by accessing an instance of D through a less derived type in which the method is not hidden" as "WTF just give the method a name that remains visible...".
|
|
|
|
|
That wasn't my sentence; it's a quote from the linked document... I need to find a clearer way of indicating such.
|
|
|
|
|
There is no escape, it is your post that led to a solution...
|
|
|
|
|
Hi,
How many maximum Threads can be created in CLR Thread pool?
|
|
|
|
|
The standard thread pool allows 25 threads per processor, but there are a number of improved thread pool implementations that allow you to go beyond this. You may want to look at this[^] implementation.
|
|
|
|
|
MSDN does not give a specific number, but it does list a number of remarks.
In short, you dont know (which means it may vary), and dont exagerate !
|
|
|
|
|
Hi!
I want to to fire a number of asynch method calls from a main thread and have the main thread return true synchronously if the method calls all return true, otherwise false.
The asynch method calls should have a timeout which makes them return false. How to best implement in .NET 2.0? Performance is an issue!
Pseudo code:
<br />
public void main() <br />
{<br />
SynchObj sObj = new SynchObj();<br />
bool allTrue = sObj.SynchCall();<br />
}<br />
<br />
public class SynchObj<br />
{<br />
public bool SynchCall() <br />
{<br />
bool allTrue = false;<br />
<br />
<br />
return allTrue;<br />
}<br />
}<br />
<br />
public class AsynchObj <br />
{<br />
public bool AsynchCall(int timeout)<br />
{<br />
}<br />
}<br />
|
|
|
|
|
Have you looked at WaitHandle.WaitAll ?
only two letters away from being an asset
|
|
|
|
|
And hello again !
I have a problem. I was using a soap serialization in assembly called "Catalog". I've got a file Data.xml.
Then i was trying to serialize this file to another program ("LogBook").
I've got error:
Parse Error, no assembly associated with Xml key a4:http://schemas.microsoft.com/clr/nsassem/CatalogBeta/Catalog_2.0%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull strBook
What should i do ? How can i deSerialize this file ?
One nation - underground
|
|
|
|
|
The assembly you are serializing into also needs to know about the data structure that was serialized. If you want to serialize the data like this, you will need a third intermediary assembly that contains the class definition that is referenced by both of the other assemblies.
Remember, serialization and deserialization are essentially a transport mechanism to take the binary state of an object from one context (serialization) and transfer it to another context (deserialization). Both contexts must understand the data structure being manipulated.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I would like to be able to let people enter special fields and HTML into a Rich Textbox and then have it convert to HTML. Here is the plan. Let's just say I have these 2 fields, firstname and lastname. What I would like to have happen is to allow the end user to save this....
<br>#firstname#<br>#lastname#
into a text document and then I would have the app read the text document in, look through the doc for those special words and then replace them with the real values from the database. With that information I would just send it to browser object for display. What this is for is a phone integration and when the user clicks on the incoming call I would like them to see more information about who is calling. Giving the user a tool to add any fields they want and being able to format it anyway would be cool. I'm just not sure how to make sure everything stays HTML safe with chars like " ' / and the like. Anyone doing anything like this or could lead me into the correct direction please? Much thanks!
-- modified at 14:47 Monday 2nd July, 2007
|
|
|
|
|
Hello Everyone,
The last time I did any Windows/Win32 programming was before .NET was introduced!! Since then I've been focused on server-side Java applications but now I need to develop a Windows service. I figure C# should ease the transition into .NET and so I'm writing to this forum. If this is not the right forum for this question, please let me know which one is.
I'm looking for pointers on the quickest approach to go about implementing a service which listens in on both SMTP and POP3 traffic and based on the message headers perform some action. The behavior is just like an anti-spam application's service that monitor email.
So far, I've found sample code for creating a service. I'm hoping to find sample code for intercepting SMTP/POP3 traffic as well as an API similar to JavaMail which will help with parsing RFC822 messages.
If anyone here has previously developed an anti-spam application and is willing to be a consultant, please contact me directly. This would actually be my preferred approach.
Thank you.
Siraj.
Siraj Podikunju
SP Consulting, Inc.
sirajp@spconsult.com
|
|
|
|
|
Hi all, I want to download an xls file from remote location (Please note that its not FTP , its live ip, like myip/shared/info.xls) .I have been searching for any class or library but no success till yet. Can someone help me ? Thanks in advance.
Also, please guide how to open an excel file for reading data from it. Thanks
Kaliem
|
|
|
|
|
|
ah sorry, I forgot to inform, I am trying this with windows forms application, not web application, I guess incase of web, you can also do that using Response object, but I am looking for some control/class/library in windows app.
kaliem
|
|
|
|
|
What do you mean "remote location"? Across your network or the internet?
only two letters away from being an asset
|
|
|
|
|
Both! I want to be able to access files over my network and internet. like the file URL would be something like ipaddress/foldername/filename.xls
|
|
|
|
|
Process.Start("IExplore.exe", "\\ipaddress\foldername\filename.xls ");
Process.Start("IExplore.exe", "http:\\ipaddress\foldername\filename.xls ");
Provided the files is accessable from http of course.
only two letters away from being an asset
|
|
|
|