.net

modopt and .NET reflection

I have a CLI/C++ interface that I want to examine via .NET Reflection. Here's the function signature in the source code: class ClassA; template<typename _Type> class ClassTempA; public interface class Test : BaseFunc { public: ClassTempA<int>& SomeFunc2(ClassA inst) = 0; }; Here's what the function looks like when examined in .N...

Changing row colors in the Compact Framework DataGrid

How can I use non-default coloring in the DataGrid control in a Windows CE compact framework application? I need to color one row in color X and one row in color Y (alternating row colors basically). ...

Examples of using .NET Reflector

As a programmer who is new to .NET and C#, I find that using .NET Reflector is an incredible utility to use to see how the "professionals" write their code. Can anyone suggest good .NET based applications to use Reflector on for Desktop Applications - any application examples would be appreciated. ...

Usage of Exception handling block in Enterprise Library

Hi all: We have a ASP.NET application that uses the Exception Handling Application block to log our exception to a database (using logging block indirectly). This all working perfect. However, since it is using the exception handling block to log data, everytime we wanted to log, we'll have to new'd a System.Exception object. Since w...

Best .NET blog engine

I am thinking about switching my blog away from Community Server to something that is simpler and focuses more on just being a good blog. What are the different .NET blogging engines and which one do you recommend? ...

ASP.NET VB - Some Maths with .NET

I need your help, For example I have a decimal type variable and I want to round up this way. Eg 3.0 = 3 3.1 = 4 3.2 = 4 3.3 = 4 3.4 = 4 3.5 = 4 3.6 = 4 3.7 = 4 3.8 = 4 3.9 = 4 4.0 = 4 4.1 = 5 4.2 = 5 etc.... How can I do that? ...

Returning from inside the scope of a 'using' statement?

I've got some code that looks like this: using (DBDataContext dc = new DBDataContext(ConnectionString)) { Main main = new Main { ClientTime = clientTime }; dc.Mains.InsertOnSubmit(main); dc.SubmitChanges(); return main.ID; } If I return from inside a "using", will the using still clean up? ...

Microsoft Exception Handling Block - Isn't it a perfect example for overengineering?

Ever since Microsoft has introduced the application blocks, I've been bumping into people who use the Exception Handling Application Block. I've recently had a closer look myself and would summarize the basic functionality as follows (skip the following block if you already know what it does): The exception handling application block...

Regex to capture an optional group in the middle of a block of input

I'm stuck on a RegEx problem that's seemingly very simple and yet I can't get it working. Suppose I have input like this: Some text %interestingbit% lots of random text lots and lots more %anotherinterestingbit% Some text %interestingbit% lots of random text OPTIONAL_THING lots and lots more %anotherinterestingbit% Some text %interesti...

What is the codedom that I need to write to generate this code?

I need to do this. public class MyClass{ private static IDictionary<String, Type> databaseAccessClasses = new Dictionary<String, Type>(); private static IDictionary<String, Type> DatabaseAccessClasses { get { return DataAccessFactory.databaseAccessClasses; } set { DataAccessFac...

Send data to a Flex 3 application from an SWF (version 7).

Does anyone know how to take a swf (version 7) and use the SwfLoader or something similar to access a root variable in the swf from a Flex application? I have tried many things with no success. I don't want to clutter this post with all of my failed attempts, but I will post them later if I see that they are needed as examples. Just so...

Best way to keep GUI updated when the underlying SQL view data changes?

Let's say you have a form with a component that displays data from a view on an SQL server. The component would be something like a ListView or DataGrid - basically something that can display the data in a 2D grid format. Another application changes the data that the SQL view describes, and does this regularly but at undefined intervals....

Does One Persist XML/CSV/Other Through Repositories/Services/Other

I have an application that imports information from a CSV file or from a database and exports it to XML. This XML is currently being persisted to a file. However due to project needs I have decided it may be better to persist this XML to a database. Currently I have CSV, XML and SQL repositories that deal with importing/exporting data. ...

Regular expression to parse an array of JSON objects?

I'm trying to parse an array of JSON objects into an array of strings in C#. I can extract the array from the JSON object, but I can't split the array string into an array of individual objects. What I have is this test string: string json = "{items:[{id:0,name:\"Lorem Ipsum\"},{id:1,name" + ":\"Lorem Ipsum\"},{id:2,name:\...

.NET MVC - Call a controller Action from another controller action

I have a controller action which I would like to call another controller action. Is this a valid thing to do. Is it possible? ...

.net mvc and editing data with forms

I have a form for editing gigs. The initial controller action is called "Edit". The form posts to a second controller action called "Update" So, once the form has posted, I use a bespoke ModelBinder which uses bindingContext.ModelState.AddModelError to add validation messages to the modelstate The Update copntroller action looks this...

Is String.IndexOf(char) really slower than manual searching?!

When doing a simple performance measurement, I was astonished to see that calling String.IndexOf(char) was actually slower than doing it manually! Is this really true?! Here is my test code: const string str = @"91023m lkajsdfl;jkasdf;piou-09324\\adf \asdf\45\ 65u\ 86\ 8\\\;"; static int testIndexOf() { return str.IndexOf('\\'); } stati...

Working with byte arrays in C#

I have a byte array that represents a complete TCP/IP packet. For clarification, the byte array is ordered like this: (IP Header - 20 bytes)(TCP Header - 20 bytes)(Payload - X bytes) I have a Parse function that accepts a byte array and returns a TCPHeader object. It looks like this: TCPHeader Parse( byte[] buffer ); Given the ori...

What's the best book on designing pretty GUI for .NET applications?

Hi, What's the best book on designing pretty GUI for .NET applications? like Windows Vista style? Thank you. ...

Does Learning C#/.NET Require An MSDN Subscription?

I'm a Java EE person who would like to climb the .NET learning curve. I've always had the impression that one important difference between Java and .NET was that the Microsoft suite required that you (or your employer) had put up some coin to get access to the tools. A Java person has the advantage of being able to download a JVM, Ec...