Let's say I have List<Cookie> and I want to convert it to a CookieCollection. What's the easiest way to do this?
I know I can use a foreach loop, but isn't there a way to instantiate it with code similar to this?
List<Cookie> l = ...;
var c = new CookieCollection() { l };
When I try to compile that though, I get the error:
The be...
In C# C struct: s can be passed as arguments to C functions called with DllImport using the StructLayout attribute
http://msdn.microsoft.com/en-us/library/aa984739%28VS.71%29.aspx
How does this work in F#? Apparently it is possible somehow, but I didn't find any example code by Google and I don't know the language very well yet
...
If I write a generic class like class MyGeneric<T> is it possible to write an implicit cast to type T, so I can do stuff like:
public class MyGeneric<T>
{
...
}
public class GenericProperties
{
public MyGeneric<string> MyGenericString {get;set;}
public void UseMyGeneric()
{
string sTest = MyGenericString;
MyGene...
Anyone knows how to do this?
I tried this, but it just populates this ComboBox which I already do.
What I need is a way to get the combobox updated whenever the enum property on my object changes:
DataObject.DataEnum
but also get the above Enum updated whenever I change the selected item in the combobox.
Is it possible to do this?
...
I have previously used the arguments of a contentsResized event on a Winforms richtextbox to get the new size of my RTB.
I am now developing a WinForms app with a custom WPF RichTextBox. My whole reason for doing this is to use the out-of-the-box spellchecker.
I need my RichTextBox to expand and collapse vertically as the text is chan...
If you are running a 32 bit app on a 64 bit machine (I am using windows 7) and you write this code
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\XXX")
it will actually get the key from
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\XXX
and not
HKEY_LOCAL_MACHINE\SOFTWARE\XXX
Progromatically given a RegistryKey how do...
Hi..
I have a Change Password page that has a H2 HTML tag that says "The password has been successfuly changed". This H2 tag, however, needs to be visible only on success. That is: I want to manually activate it (Visible=true) in the "Change password" button click postback event.
The question is: What's the best way to control this H2 t...
I'm running into a very peculiar issue. I noticed that occasionally while typing into my TextBox, I'll lose some keystrokes. I added a bunch of trace statements in events hooked by this TextBox, and I found that when I lost keystrokes, the KeyUp, KeyDown, and KeyPress events all correctly fired, but the TextChanged event never fired.
...
My organization is considering which technologies to use for our next generation of systems. We will be using .NET, but have not decided which user interface technology is best. Silverlight and WPF seem to be the most appropriate options. Can someone share the pros and cons of each approach?
...
We are encountering an issue where our ASP.NET MVC app is restarting for an unknown reason. The cause of the shut down is
"A subdirectory in the Bin application directory was changed or renamed."
The file in question turned out to be C:\Users\Jason\AppData\Local\Temp\Temporary ASP.NET Files\root\f691a68c\a1593a1e\hash\hash.web.
...
How do I format the string result of DateTime.Now in C# for insertion into a MySQL database table column of type DATETIME?
I have tried the following without any success:
insert blah
(Id, Content, DateCreated)
select 123, 'Blah blah blah', 1/5/2010 9:04:58 PM
insert blah
(Id, Content, DateCreated)
select 123, 'Blah blah bl...
We have a flex application that runs along side a mvc .net application. Our flex app communicates with .net via Weborb. We recently put our entire database schema into a single dbml file. Previously we had the database schema split out into several dbmls. The problem we have run into since consolodating into one dbml is that our weborb c...
In Visual Basic 2008, there's two different ways that I know of to accomplish the same thing:
The Dim on the member level:
Dim counter1 as integer = 0
Dim counter2 as integer = 180
Public Sub SampleSub1()
Counter1 += 1 : If (Counter1 > 14) Then Counter1 = 0
Counter2 += 1 : If (Counter2 > 240) Then Counter2 = 0
End Sub
Then ther...
The Levelator is a program that you feed an audio file and it generates another one with a more constant volume ensuring that any recording problems (like a person sounding too loud, or being barely audible) are corrected.
Do you know any libraries that I could use .Net in Windows to perform the same task? Or a command-line program woul...
Hi, I declared the dictionary obj.
Dictionary<string, string> aDict = new Dictionary<string, string>();
aDict .Add("IP", "Host");
As I remembered,
The expression of aDict[IP] can return the value (Host).
Now if I go in the opposite direction.
How to get the Key from Value ? aDict[Host] ?
Does the Dictionary is a one-way...
Does anyone know how to register any extension into the registry and open it with program X in C#?
For instance, when installing Word, it adds the extensions .doc, .docx etc... and then when you double click on the file Word opens up this file.
This I want to achieve with my own program. Double clicking file.xxx opens up the contents usi...
I have been doing some extensive testing of a Windows Service I have been writing in C# .Net 3.5. I am having trouble getting Windows to give me enough time for my service to shutdown properly when I restart or shutdown the computer even though I am invoking the RequestAdditionalTime() method which should update the SCM and keep my serv...
I'm getting error below when I debug my ASP.NET MVC app.
Any thoughts on how I could solve this?
Any idea how the problem would have occurred in the first place? I promise you I didn't go randomly deleting dll's from deep within protected directories on my system.
Server Error in '/' Application.
Compilation Error Description...
Is it possible to get the open tag from a XmlNode with all attributes, namespace, etc?
eg.
<root xmlns="urn:..." rattr="a">
<child attr="1">test</child>
</root>
I would like to retrieve the entire opening tag, exactly as retrieved from the original XML document if possible, from the XmlNode and later the closing tag. Both as stri...
I'm building .NET application that uses DirectX API for web camera device rendering.
I'm using DirectShowNet Library .
When I create instance of for ICaptureGraphBuilder2 interface and call RenderStream like bellow
Guid cat = PinCategory.Still;
Guid med = MediaType.Video;
hr =capGraph.RenderStream(ref cat, ref med, capFilter, null,...