.net

convert ienumerable linq list to typed list

Hi, I'm having the following issue: I'm using linq to filtrate some data in this way: var listPerson = (from objPerson in ListPerson select new { objPerson.IdPerson, objPerson.ApePerson, ...

Visual Studio 2010 with ASP.NET MVC1.0

Is it possible to use Visual Studio 2010 to write code for shared hosting that is designed for .NET 3.5 and ASP.NET MVC 1.0? I've been trying for a while to get a project to run that uses only 1.0 features, and it just will not translate over very well. ...

Should folder names start with a period?

Are there any guidelines or standards out there for folder names starting with a period? (e.g.: .NET). I have an installer that requires this to happen and right now we are using 'DotNET' instead of '.NET' for our folder names. Thanks! ...

Change application settings for a deployed class library?

If I define application level settings (using Properties.Settings) within a class library, can I change those settings once that dll is deployed to an app? If so, how? Do I just create the equivalent setting in web.config to override it? ...

c# control name

I would like ask about the name of the control that is used in MS Project for scheduling? and if it is possible to give me some idea how programmatically it works? ...

Is there a way to enable the IE8 Developer Tools from inside WebBrowser control in a .NET application

If you have IE8, you may have noticed a really handy feature that MS has added. Hit F12 and Developer Tools, a firebug like debugger, pops up. This is extremely useful for debugging purposes, and i'm wondering if there is a way to pop up the Developer Tools from a WebBrowser control inside a .NET application. My situation is this: I hav...

Building a worker thread pool for a non-thread-safe code

What's the best way to wrap non-thread-safe code in the .net framework? I've got a third-party library that isn't thread safe due to its use of static variables. Rewriting it isn't an option. This library is used by an asp.net web service that receives lots of simultaneous calls. I've currently got it wrapped in a proxy class that uses...

FlowDocument contents as text

What is the best way to get back the XAML/XML value of a FlowDocument? I noticed there isn't a .Value, .Text, .Caption, .ToXml(), etc... UDPATE: I'd like to be able to get access to it initially to serialize to disk or database. Treat it as its own document format. Later translating it to other formats would be nice. Also been wonder...

Can I force my own short-circuiting in a method call?

Suppose I want to check a bunch of objects to make sure none is null: if (obj != null && obj.Parameters != null && obj.Parameters.UserSettings != null) { // do something with obj.Parameters.UserSettings } It is an alluring prospect to write a helper function to accept a variable number of arguments and simplify this kind ...

HttpWebRequest issue.

I am having a slight issue with the HttpWebRequest protocol, and I am wondering whether I should try a different approach or perhaps I am doing something wrong. The issue I am having is this. I have a client/server which sends a HttpWebRequest to a server. The server receives this response, then runs a small utility which generates a fi...

Adding collected errors to database

I have an application that monitors a process and "learns" exceptions, by adding them to a DB. The process to gather the errors/exceptions is pretty solid, but not the storing on the DB side. What I want to accomplish is something like public int GetErrorId(string StringToClassify) { sql = "SELECT [id] FROM [DBNAME].[dbo].[ERRORS] WHER...

Searching Subdirectories in C#

I have a list of file names, and I want to search a directory and all its subdirectories. These directories contain about 200,000 files each. My code finds the the file but it takes about 20 minutes per file. Can someone suggest a better method? Code Snippet String[] file_names = File.ReadAllLines(@"C:\file.txt"); foreach(string fil...

Capture Raw NIC IO from .NET Socket as a .NET BitArray

Hi all, I want to master certain raw protocols to learn about TCP Stream resuming. I am versed in .Net sockets, and would like to initiate a TCP stream so: Socket socket = new Socket(Tcp) socket.connect(IPAddress); socket.send(new byte[]{155}); socket.close(); Then be able to read the raw IO network card data sent/recieved and save ...

Trouble binding a BindingList to ListBox.

In the app I'm working on, I need to maintain a list of Projects which are currently loaded, and display the names of each one in a ListBox (okay, multiple ListBoxes, but that's neither here nor there). class Project { public String Name; // Etc. etc... } I've got a BindingList object which contains all of the loaded Projects...

Where to place Business Entities, Enums, Custom exceptions?

I'm trying to figure out how to share my entities between the data, business, and UI tiers. Is it best to create a separate project for these entities that will be referenced by all the tiers? What about Enums and custom exceptions? I have some enums used only by the UI project, and some that are used by the Business. Does this mean ...

A GINA replacement in a .NET language?

I have searched quite a lot of places and I only found one GINA replacement called pGINA but it is in C++ which I don't know at all. Does anybody know one in either C# or VB.NET? (I'm writing software for use at work to control what employees are doing) ...

NHibernate parent mapping does not create child foreign-key

Hello, I am just learning NHibernate. I have been using examples from the documentation and here at stackoverflow, but I must be missing something. I have a PARENT object that has a collection of CHILD. A CHILD is meaningless without a PARENT, so the database has FK set to NOT NULL. Implementing NHibernate from CHILD to PARENT works f...

System.Net.WebClient and "DELETE" method

If I call System.Net.WebClient.UploadFile(fileUrl, "DELETE", localFileName), is the file at localFileName actually uploaded to the server? Is there a better way to accomplish this? ...

Layout of .NET value type in memory

I have the following .NET value types: [StructLayout(LayoutKind.Sequential)] public struct Date { public UInt16 V; } [StructLayout(LayoutKind.Sequential)] public struct StringPair { public String A; public String B; public String C; public Date D; public double V; } I have code that is passing a pointer to a v...

C# Child Process from Legacy C++ App Windowing Problems...

We have a c++ legacy application and have been extending it with c# applets that are invoked using COM from the parent c++ app. They bring up windows that are not modal. Moreover, I think these .NET windows are not proper children of the c++ application, since EnumChildWindows misses them, and EnumWindows finds them. One child-like beh...