.net

In c# convert anonymous type into key/value array?

I have the following anonymous type: new {data1 = "test1", data2 = "sam", data3 = "bob"} I need a method that will take this in, and output key value pairs in an array or dictionary. My goal is to use this as post data in an HttpRequest so i will eventually concatenate in into the following string: "data1=test1&data2=sam&data3=bob"...

Translate Resources

Hi. How Can i translate .Net resources to another language? i am looking for a software that able me to translate .NET resource from a language to another language. For example Persian to English. i saw the software that used Google translate API for translating. but it just translated from English to another... thanks. Please Introduce ...

What is the right way to count total visitor in a website?

Hello guys, I'm facing with an old problem that it made me confuse very much. So I need your advice to make sure that I've been using the right way. My demand is to count the number of visitor in my website, so I've coded in Global.asax file: void Application_Start(object sender, EventArgs e) { // Get total visitor from database ...

how to create intersecting linked lists in C#?

Hi, I'm trying to create 2 linked list with a common intersection node. As I see this is a very hot question in LinkedList to find the intersection node. I have written following code but it throws InvalidOperationexception. LinkedList<int> LL = new LinkedList<int>(); LL.AddFirst(5); LL.AddFirst(4); LL....

Determining a Generic Type at Runtime in Non-Generic Class

I've gotten myself in a pickle, and could use the help of a guru... I have a Journal that records entries for different types: Journal(Of ParentT) - Parent could be Customer, Address, other classes The constructor of the Journal requires knowledge of the Type parameter: Public Sub New(Parent as ParentT) In my consuming form, I take ...

Is there a technique for re anti-aliasing an image to a different background color?

Is there a programmatic approach for drawing an anti-aliased image on a new background color / pattern that would re-anti-alias the image to the new background color? Preferably accessible to a .Net program? ...

What is C# purpose?

Please, anybody, can you explain what the purpose of C# language and .NET platform? What do you think about prospects of this language? thanks in advance. ...

Counting duplicates in a Listbox

I am trying to develop a simple application in C# to count the number of duplicates in a listbox. I need to count all the number of duplicates and display a rank suffix to the top 3 elements most duplicated. For example, suppose a list has 7 elements called 'apple', 6 elements called 'pear', 4 elements called 'peach' and 3 elements calle...

Skinning MSI pckages.

I have a game application developed using C#. Is there any way to skin my MSI (installer) package ? ...

How can a new Form be run on a different thread in C#?

I'm just trying to run a new thread each time a button click even occurs which should create a new form. I tried this in the button click event in the MainForm: private void button1_Click(object sender, EventArgs e) { worker1 = new Thread(new ThreadStart(thread1)); worker2 = new Thread(new ThreadStart(thread2)); worker1.S...

Can I run .NET 4 programs on Mono?

Hi, Mono seems to support .NET 3.5 only, but does that mean I cannot run programs made with .NET 4 on it? ...

User settings are not saved (Settings.Default.Save();)

In the properties of project I created a setting like this NumberOfUsers int User 10 The columns are Name, Type, Scope and Value. Then there is a ComboBox where user can set a 'NumberOfUsers'. This combo has SelectedIndexChanged event where I save the changes whenever the user change the value of combo. Here's the code: Settings.De...

COM+ Component hosted by Windows Service in C# to control an external device

Hello, I have a Windows Service written in C# that controls a device connected to the computer by RS232 (gathers data and allows to control the device). It's named DeviceService and it's working properly. Now other applications use it by WCF services. But now I need to expose some of functionalities as COM+ Component, so applications i...

Is there anything readily available in the .NET framework of the form EventArgs<T> ?

Is there something like this already available in the .NET framework? public class EventArgs<T> : EventArgs { private readonly T data; public EventArgs(T data) { this.data = data; } } I know there is a generic event handler, I'm kinda surprised I can't find a generic EventArgs class. Thanks ...

Is there any way to get the PropertyInfo from the getter of that property?

Is there any way I can get the PropertyInfo for a property from its getter? Like this: public object Foo { get { PropertyInfo propertyInfoForFoo = xxx; ... } } I want to avoid having to hard code the name of the property as a string, as that's tricky to maintain. I'm using .NET 2.0, so I'm hoping for a lin...

Is it worth to learn COM?

I am thinking to learn COM.But I heard that Microsoft launched .NET as an alternative to COM. So is it worth to learn COM? actually I started learning COM for UMDF device driver. Is there any alternate way to work on UMDF except COM? ...

NorthscaleClient does not Set values consistently

I am using NorthscaleClient from Enyim Memcached client libary to store objects in Northscale Memcached Server. Below does not work consistently, assertion fails most of the time. Am I doing anything wrong? // File size is 360kb var reader = File.ReadAllText(@"c:\RHDSetup.log"); for (int i = 0; i < 10; i++) ...

In C#, how can I know programmatically if the Operating system is x64 or x86

Hi All, In C#, how can I know programmatically if the Operating system is x64 or x86 I found this API method on the internet, but it doesn't work [DllImport("kernel32.dll")] public static extern bool IsWow64Process(System.IntPtr hProcess, out bool lpSystemInfo); public static bool IsWow64Process1 { get { bool retVal = fa...

Implementation question of the Presenter in MVP

So..I intend to use a Model View Presenter(the "passive" mode, in which the UI is pretty dumb and sends all the events to the Presenter, and the Presenter takes care of dealing with the Model) to glue my domain's business logic and the UI. My question is how should my Presenter look like. Is this what I want? public class TicTacToeGame...

Asp.net MVC seems to be binding a List<string> property of my model incorrectly in certain environments

We have developed an asp.net mvc application which is an internal application. Our web app is accessed through other websites/applications on our companies network. One of the applications is a windows app that displays the site through a web browser in its application. I've been told by the developers of that application that it uses...