.net

SQL Bulk Stored Procedure call C#

How do I call stored procedures in bulk? I would like to do something like a bulk copy. All that the stored procedure does is 8 selects for unique constraint and 8 inserts. With no returning value. ...

C#/.NET XML Serializer - using a property as element name

Warning -- I'm not an xml guru. Here is what I have: <Fields> <Field name="BusinessName" look-up="true">My Business</Field> <Field name="BusinessType" look-up="false">Nobody really knows!</Field> </Fields> This maps back to: [XmlArrayItem(ElementName = "Field")] public List<UserInfoField> Fields; and [Serializable, XmlRoot("F...

How to flatten a type (not an enumerable) through Linq?

All of the examples for SelectMany I see are flattening arrays of arrays and so on. I have a different angle on this question. I have an array of a type, and I want to extract that type's contents into a stream. Here's my example code: public class MyClass { class Foo { public int X, Y; } static IEnumerable<int...

Rights for creating SRV records

In a Windows 2003 domain, I would like to create a SRV record programmatically at install time to advertise to clients where my server is located. Since I do not have the luxury of running as Domain Admin, what kind of permissions do I need to have to create the SRV record? Generally I'd be using the .NET classes to create the SRV reco...

DataContractSerializer and List(Of Exception)

How can I serialize a list of Exception objects (also including derived exceptions, eg. FileNotFoundException) with the DataContractSerializer? I always get an error about the serializer not knowing the types in the list so i devised a workaround. It looked something like this: Dim XmlSerializer As New DataContractSerializer(Excep...

Profiling a .net library

I'm referencing a class in a .net library in VB6 and need to profile it. Is there a profiler that can be pointed at a .net library dll? The memory issues I wish to profile only happens when used in the VB6 application. The pure .net test application for the library does not have memory issues. ...

How to monitor a .Net server application for fatal exceptions?

I am developing a .Net server application, which is supposed to run continously. I would like to have a notification email sent each time the server process is terminated for any reason. Ideally the email should contain the exception message and stacktrace if an exception caused the termination. I am aware that certain exceptions can not...

What is are the tradeoffs of developing under Windows CE 6.0 vs Windows Mobile 6.1

I have a Windows .NET application that I plan to "port" and tailor to a mobile device. The application consists of a standalone .NET program that works with a barcode scanner, has a simple UI and records the scans to a file. There is also a Windows Service that synchronizes data to a server using web services (proprietary sync protocol...

.net : best way to check if an appSetting is present in configuration file?

I would like to add a check to ensure all appSettings used in my class indeed exist in the configuration file. What is the most reliable way to do this? I know I could check each value for null, but are any of you guys using an XSD approach? Or do a more dynamic approach, or is the best way to manually check and maintain a list of value...

C# StreamReader in a try/finally

I have a question today involving the StreamReader class. Specifically initializing this class using the filename parameter for example: TextReader tr = new StreamReader(fileName); Obviously when this action is finished, its important to close the stream like this: tr.Close(); I would like to have this in a try / finally, the prob...

WCF Role Service and HttpContext Question

I'm using WCF RoleService (I built a custom role service on top of it) to get a list of roles for a given user. What I'm wondering is, should I be setting the FormsAuthenticationTicket's UserData property (when it's created) with these roles on the server side? Note: I guess it doesn't make sense for a client application to do this (I'...

Where should I place unmanaged .dlls in a .NET project using VS2008?

So far I've been placing the dll into the /bin folder because it seems to be the only place it will get loaded when a DllImport'd function is called, but it just doesn't feel right since it's the output folder and it'll probably be wiped after a 'project clean' or 'rebuild all' operation. How should I do this? Thanks in advance. Note: ...

How to check if a WCF service is operational?

Is there a quick and reliable way to check if a WCF service is available and accepting requests, perhaps some best practice built in method? Obviously from code. Thanks ...

WCF: Where is GetRolesForUser? all I see is GetRolesForCurrentUser

Guys, When I create a custom role provider by inheriting from RoleProvider, I created a method called public override string[] GetRolesForUser(string username) .. However, when I try to use this Service Reference all I have access to is GetRolesForCurrentUser(). It works and calls my method behind the scenes ok. As in, GetRoleseForCurre...

How can i remove the task bar entry of a GTK# window?

... Just like the ShowInTaskBar property of a WinForms form. ...

Where do I start if I want to build an addon that uploads selected code to a server, in Visual C# Express/Studio?

I had an idea just now and I think it's pretty good. Select whatever code you want from your .cs/.vb file and on right click there will be an option that says 'Upload to PasteBin'. Where would I start? ...

What would be a good replacement for C++ vector in C#?

I'm working on improving my skills in other languages, coming from using c++ as my primary programming language. My current project is hammering down C#.net, as I have heard it is a good in-between language for one who knows both c++ and VB.net. Typically when working with an unknown number of elements in c++ I would declare my variable...

Distributed Computing applications

Map reduce/Hadoop is one of the framework/program that s used for distributed systems. What are some other popular frameworks/programs? Thanks. ...

XtraGrid Suite - is there a way to add a button or hyperlink to a cell?

I'm working with the XtraGrid Suite made by DevExpress. I can't find any sort of functionality to do this, but I'm curious if you can add a button or hyperlink to a grid cell. Context: I've got an Events list. Each Event has a Time, Start/End, and a Category (Utility and Maintenance). There can be Start events and Stop events. Having do...

Is there any way to negate a Predicate?

I want to do something like this: List<SomeClass> list1 = ... List<SomeClass> list2 = ... Predicate<SomeClass> condition = ... ... list2.RemoveAll (!condition); ... list2.AddRange (list1.FindAll (condition)); However, this results in a compiler error, as ! can't be applied to Predicate<SomeClass>. Is there any way to do this? ...