I have a few classes:
class Vehicle
{
}
class Car : Vehicle
{
}
I have a list of the derived class:
IList<Car> cars;
I would like to convert the list to its base class, and have tried:
IList<Vehicle> baseList = cars as IList<Vehicle>;
But I always get null. Also
cars is IList<Vehicle> evaluates to be false.
Gr...
I'm planning on implementing some tests using nUnit. I also have a homegrown metrics recording library that I'd like to use to use to get some metrics out of the test. Said metrics library is normally used in applications, and is usually used something like this:
// retrieve configuration.
string path = GetPath();
bool option = GetOpt...
This is a followup to
WinForms RichTextBox: how to perform a formatting on TextChanged?
I have a Winforms app with a RichTextBox, the app auto-highlights the content of said box. Because the formatting can take a long time for a large document, 10 seconds or more, I've set up a BackgroundWorker to do the re-formatting of a RichTextBox. ...
I am trying to extend a Terminal control from The Code Project based on the Poderosa Project. The part I am stuck on is trying to call a method in the control wrapper class from a class in the Poderosa project. The method is going to buffer/queue the char’s and lines of text going to the terminal screen so that they can be processed wit...
I would like to have your opinion and suggestion regarding the solution to this specific problem:
I have a rewritemap that takes care of a lot of vanity URLs, problem is, users may enter that vanity URL ending with a "/" or no "/", the matching does not occur in both cases, only one is matched, so I decided to create a rule first, that ...
I have a PreviewKeyDown handler on my mainwindow which handles up and down keys so I can navigate with the keyboard between my controls.
Now I have the problem that in some Textboxes I also want to use the up/down keys. This seems impossible because the other handler seems to swallow the keys first.
Is it possible that when one of thes...
We are trying to decide the best decision to maintain state across our web application. We are incline to use Encrypted cookies on the browser, but some of our developers think we should go with Session variables on the server.
The main reasons why I think Cookies are a best approach is just because we will not depend on the app serv...
I have 3 sql tables SourceKeys, Channels, and ChannelTypes. These tables are queried and their data is stored in datatables in my dataset.
What I need is this:
SELECT ...
FROM ChannelTypes ct
LEFT OUTER JOIN Channels ch ON ct.channelTypeID = channelTypeID
LEFT OUTER JOIN SourceKeys sk ON ch.channelID = sk.channelID
but in linq form....
I am trying to make a custom control in WPF. I want it to simulate the behavior of a LED that can blink.
There are three states to the control: On, Off, and Blinking.
I know how to set On and Off through the code behind, but this WPF animation stuff is just driving me nuts!!!! I cannot get anything to animate whatsoever. The plan is...
It would be useful for example to deploy an asp.net mvc app in iis 6 without the extra steps.
In this case i would like to register a map for "*.mvc" to the asp.net handler
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
...
Yes, the title doesn't make much sense, but here's my situation.
I have two interfaces, say IGen and ITrans. Some of my classes implement IGen, some implement ITrans and some implement both
ITrans has one method (Translate) and IGen has one method (Generate). For the classes that implement both ITrans and IGen Generate simply calls Tra...
I would like to publish my app to a website so users can download via a URL and the app can update from the same location.
I have 'standard' Linux hosting, but I get the message when trying to publish with ClickOnce: The Web server does not appear to have FrontPage Server Extensions installed.
Is Windows (ASP.NET?) hosting required for...
http://msdn.microsoft.com/en-us/library/x810d419.aspx
From what we can see on MSDN, it says to be careful about which expressions we put as they change from language to language. My question is: what are the supported languages for writing those expressions? If various languages can do it, how does it detect which language is being used...
Why use of Reflection in .net C# code are recommended?
Is it definately a good parctice to use it?
What will the possible situations in a project to take maximum benefit of reflection, can we identify some?
...
Hi,
Told by my boss to use Moq and that is it.
I like it but it seems that unlike MSTest or mbunit etc... you cannot test internal methods
So I am forced to make public some internal implementation in my interface so that i can test it.
Am I missing something?
Can you test internal methods using Moq?
Thanks a lot
...
I'm building a very slimmed down website. And I would like to know what I can do, to improve performance as much as possible.
The site should do something like,
fetch a header from the request.
make an asynchronous SOAP call.
redirect the request to another server.
To be able to do this I also need to be able to use the cache. So! W...
I have a .Net class library. I want to pass a hidden variable from once code behind page and fetch it in another code behind page.
PLease note I dont have any design page(aspx page) where I can use form tag and get/post method.
How can we do this?
NB: I want to use hidden fields to pass value from 1 page to another.
...
is it possible to generate short guid like in youtube (N7Et6c9nL9w) ? how can it be done? (i want to use it in web app)
...
I'm pretty new to regular expressions, but I'm sure a regex would give me something much more elegant than anything I could do with string methods.
I've got a hyperlink in the form of:
<a href="http://server.com/default.aspx?abc=123">hello</a>
I want to yank out just the querystring portion. Also, what's a good reference fo...
hi all,
I have met a problem with asp.net. Textbox can't be updated. "Main Thread" runs on Page_load. It calls child thread, which change the text of textbox, recursively.
Here is my code
serverSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
//Assign the any IP of the machine and list...