.net

How to resize a Canvas in WPF?

I'm writing a WPF app that has a canvas in it. This canvas will be custom rendered at runtime. It's sort of like a game in that it needs to be measured in pixels. I need to be able to set my Canvas to 478x478 pixels (client rectangle size). I don't want any scaling or other resolution-independent steps to take place on my Canvas. I'm no...

Quickest/simplest way to refresh datagridview ?

I have problem with updating my datagridview after inserting new data to table. It seems DataSet ,to which datagrid is bound, does not refresh and i cant force it to do so.The only way to refresh dataset is to reset application. I know i can make new DataSet and fill it with table's data every button "Refresh" click ,but i wonder if its ...

How can one get the "basic" types in a "container type" in .NET?

Hello, I'm after a method which, when passed List<List<int>> will return {int}, when passed double[,] will return {double}, when passed Dictionary<string, byte[]> will return {string, byte} and so on. Basically, it's about recursing down the input type until the type found is not a "container type" anymore and then reporting this "basic...

Retrieving configuration sections through WebConfigurationManager and Configuration objects

hi We can retrieve configuration sections from web.config in the following two ways: Configuration config = WebConfigurationManager.OpenWebConfiguration("/"); AuthenticationSection authSection = (AuthenticationSection) config.GetSection(@"system.web/authentication"); OR AuthenticationSection authSection = (Authen...

Profiling thread sync lock contention.

In the past I've used performance profiling tools such as nprof, Equatec profiler and Yourkit profiler to identify and remove/reduce performance bottlenecks in code mostly running in one thread (serialized execution). Nowadays I write a lot of multi-threaded code which can be slowed down by lock contention; what tools and tricks can be u...

Is there a readymade decorator available to cache the function return value based on paramaters?

C# Win Forms Application, requires caching of function's return values, that should be based on the parameters so if function's parameters changes while calling the function it must call again, but for same parameters it should return the value directly from cache, is there any existing C# facility available or any rapid easy technique o...

What's wrong with installation of an application by copying Bin>Debug folder content?

For a testing usage of not very complex WPF applications I often don't make installer - just, after building project, copy Bin>Debug folder content of a VS2008 project folder to a hard drive of a user computer and put an icon to a desktop. No records to windows registry. Are there any drawbacks of such a way of using windows application...

Deploying Mono Apps on MacOS

I have an app that was developed for Windows but runs fine on MacOS under mono without any modifications (yay!). However, since it's an exectutable, OSX doesn't recognize it as a native file type, meaning you have to drop to the command line to run 'mono appname.exe'. It also doesn't show the application icon. In case it matters, my t...

Web dev-frameworks, compatible with .net 3.5 +

For someone, new to .Net based Web development: what web development frameworks are provided with or are compatible with .Net framework 3.5 +. Like ASP.NET Web Forms pattern ASP.NET MVC framework / pattern (1.0, 2.0) can you provide links as well Thanks ...

Does .net have an equivalent to Java's .properties files?

To jog everyone's memory, Java has these files with an extension of ".properties", which are basically an ASCII text file full of key-value pairs. The framework has some really easy ways to suck that file into (essentially) a fancy hashmap. The two big advantages (as I see it) being extreme ease of both hand-editing and reading/writing....

DateTime DayOfWeek Comparison

Id like to Compare a date to see if it is before Saturday like so: //Check if Saturday YET if (MYWorkDay.DayOfWeek < DateTime.DayOfWeek.Saturday) IGottaWork(); else Party(); There seems to be no way to do this. Is there a way? Thanks in advance ...

Code generator for SQLite and .Net

What code generator tool you are using for SQLite and .Net ? ...

.NET / SQLite. Inserting parent/child record; how do I get the foreign key?

I use VS 2008 (C#) and SQLite via ADO.NET 2.0 Provider (SourceForce project). The database used by application contains an "employees" (parent) and "employmentHistory" (children) datatables. "eploymentHistory" datatables is supposed to contain all the working contracts for any given employee from day 1 (e.g. a promotion will generate a ...

Why does Apple allow .NET on the iPhone but not Flash?

From what I understand, Apple has banned the Flash runtime on the iPhone because Apple doesn't want an alternative runtime environment to that which Apple provides via their own tools. Allowing a Flash runtime, according to Apple, would allow developers to circumvent application update policies and other controls which Apple has put in ...

How to serialize a class that contains objects of other classes (recursive serializing?)

How can I do this? Or will the serializer automatically go with recursion, and serialize all those child objects into XML? Give me an example how would you serialize classes that contain other classes' objects in themselves! That was the core of this question! I've tried this, and it didn't output anything (except the XML header) to th...

What are the main drawbacks of using Presentation Model in code behind?

I am trying to prepare myself for being challenged with the question: "Why cant we just implement the presentation model in the code behind?" In fact I have worked on a project where we used a Presentation Model that was implemented in the code behind. It worked fairly well, we were even able to run unit tests on it. Yes you have a dep...

HTML controls in VisualStudio.net

What is the purpose of providing HTML controls with VS.net? Why would someone choose to use HTML controls over .net web server controls? ...

Can you access a Virtual Directory outside of an ASP.NET website?

Can you access a Virtual Directory outside of an ASP.NET site? For example, in a Console application? ...

Convert an unsigned 16 bit int to a signed 16 bit int in C#

I'm writing a datalog parser for a robot controller, and what's coming in from the data log is a number in the range of 0 - 65535 (which is a 16 bit unsigned integer if I'm not mistaken). I'm trying to convert that to a signed 16 bit integer to display to the user (since that was the actual datatype before the logger changed it). Can so...

Linq to Xml Convert a list

I am having trouble wrapping my mind around how to do this in linq. How can i convert this: <mytags> <tag1>hello</tag1> <tag2>hello</tag2> <tag1>MissingTag</tag1> <tag1>Goodbye</tag1> <tag2>Goodbye</tag2> </mytags> to this List<MyObject> public class MyObject { public tag1; public tag2; } ...