.net

What is going on here? (.Net) GC.CollectionCount(0) keeps increasing.

While testing application performance, I came across some pretty strange GC behavior. In short, the GC runs even on an empty program without runtime allocations! The following application demonstrates the issue: using System; using System.Collections.Generic; public class Program { // Preallocate strings to avoid runtime allocatio...

Pass Parameter to thread problem.

hi. In a datagridview I have an IP address field. when I click on check status button I make thread for each row in datagridview and then call a remote object on the host on that IP and get some information and set another datagridview field as thath info. but there is a problem. the info is wrongly set on datagridview. why? privat...

One executable that starts as console or win32 service based on command line parameter in .NET?

Is it possible to write executable application in .net that can be registered as Win32 Service and operate as service but for debug purposes can be launched as console application with console output (as performance counters, text log files are not very useful for monitoring) Or shall I put application logic (Application class) in a se...

Databinding in .NET - Datatables, Dataviews and BindingSources

Hello, When binding to datatables in visual studio, it sets the datasource of a bindingsource to the selected datatable - which is fine and is what is expected. However, the datasource is actually pointing to a dataview of that datatable. I'm currently implementing custom business object base classes which include collection classes. I...

Interlocked class

Hello everyone. Up to this point I used lock(object) construction for acces to shared variables. After reading msdn article about Interlocked The Increment and Decrement methods increment or decrement a variable and store the resulting value in a single operation. On most computers, incrementing a variable is not an atomic operation,...

Scaling and Serving Images With .NET 3.5

Hi, I am working on a web application where images has to be scaled dynamically and served to the client as fast as possible (with low overhead). I need to create something that scales and compresses high-quality PNGs to medium quality JPEGs. Now, there are multiple ways of doing this and I am slightly confused which method provides th...

What do i build my alpha platform on, PHP, Ruby, Python, .NET, etc?

I am developing a social networking website in the facebook/foursquare-ish space. I have gotten such varied feedback on what platform I should develop in. Of course it will be heavily influenced by who I hire, but i was hoping for a little additional feedback from the larger community. Thanks. ...

How to calculate a bezier curve with only start and end points?

I originally posted a much simpler (and less helpful) question, and have edited this to be more specific. This animation from wikipedia shows basically what I want to accomplish, however - I'm hoping to have it flipped around, where it starts progressing more towards the destination and "up" (in this image), and then arcs more directly ...

How to get cell value change when closing form?

Hi, I have a form with a DataGridView on it. In this DataGridView there is a DataGridViewComboBoxColumn. When changing the value of a cell of this DataGridViewComboBoxColumn, the CellValueChanged-event is only fired when leaving the cell (for example, if I click into another cell). The event is not fired when I change the value and the...

C# - Bad Practices

What are some of the bad practices you have seen in C# or .NET in general, there are plenty of posts on "good" practices, but I have not seen one on bad practices. If this is OT then please delete. ...

Ignoring specified encoding when deserializing XML

I am trying to read some XML received from an external interface over a socket. The problem is that the encoding is specified wrong in the XML-header (it says iso-8859-1, but it is utf-16BE). It is documented that the encoding is utf-16BE, but apparently they forgot to set the correct encoding. To ignore the encoding when I deserialize ...

Executing another EXE under the same process of the calling EXE

I have one EXE (built in .Net) running on windows. When it runs, it'd get another EXE from server and execute under that same process. Using Process.Start I can execute the server EXE after dowloading but that'd start a new process with an extra step of downloading the EXE residing on the server. But I wanted a better solution. ...

.NET user settings event handlers

I am trying to use the built in .NET application settings. So for instance I have a User setting of year. If the end user changes the setting in the program I need to respond by refreshing the data displayed. I currently have code like below to do this: Settings.Default.PropertyChanged += SettingsChanged; //on year change clear out ...

ASP.NET How to determine if authenticated user can access a page or directory?

I need to check if an authenticated user is authorized to access a directory. I have done this before with a base class library method, I just cannot remember what class it's part of or what it's name was. I think the method was a static method and the class may have had the word Utility in it's name, but I just can't remember or find ...

How to force execution in new thread

I have such code in my app: var t = new Thread(new ThreadStart(new Action(SomeClass.SomeMethod))); t.Start(); ... t.Join(); but as I understand, compiler does some optimization and run SomeMethod in the same thread as main code. I check this by setting different Names of the thread in t and Thread.CurrentThread. How I can create and ...

The type parameter 'POCO Class' in ExecuteFunction is incompatible with the type 'EFComplexType' returned by the function

We've got an EF model that's using POCO generation for its types. We added a stored procedure and created a function import for it. We then generated a Complex Type for the result set and let the T4 template generate the business contract (POCO). Everything works great in our development, devint, and QA environments. When we deploy to p...

How can I save the values entered at design time for a complex property?

I'm still learning the ropes when it comes to implementing custom editors for complex properties at design time. As a simple starting point, I'm trying to enable design-time editing of a property of type ICollection<string>. What I've done so far is: Wrote a StringsEditor class, which derives from UITypeEditor and displays a drop-dow...

What do braces after C# new statement do?

Given the code below, what is the difference between the way position0 is initialized and the way position1 is initialized? Are they equivalent? If not, what is the difference. class Program { static void Main(string[] args) { Position position0 = new Position() { x=3, y=4 }; Position position1 = new Position(...

Does ILMerge actually merge assemblies, or just put everything in one file?

What does ILMerge do? Does it create a single new assembly, or just put multiple assemblies in to one dll? I'm asking from the perspective of: What happens when I'm merging assemblies that have InternalsVisibleTo attributes to each other? What happens if I'm doing reflection from strings from fully qualified assembly names Thanks ...

How to use LINQ Contains() to find a list of enums?

I have an enum called OrderStatus, and it contains various statuses that an Order can be in: Created Pending Waiting Valid Active Processed Completed What I want to do is create a LINQ statement that will tell me if the OrderStaus is Valid, Active, Processed or Completed. Right now I have something like: var status in Order.Status...