.net

How to store a factory used in a derived class to initialize its base class?

Assuming you had some kind of factory-created resource that would still belong to the factory after construction like this: public class Resource : IDisposable { public void Dispose() { /* ... */ } } public class ResourceManager : IDisposable { public Resource Load() { /* create resource and add to list */ } public void Dispose()...

How to specify maxExclusive on struct?

I want to create a structure Degrees for a GPX library. In the XSD for GPX (GPX 1.1 Schema) degreesType is defined as minInclusive = 0 and maxExclusive = 360. The structure now shall have two public static fields MinValue = 0 and MaxValue = x: public struct Degrees : IFormattable, IComparable, IComparable<Degrees>, IEquatable<Degrees> {...

How do I create a toolbar for the Taskbar on Windows?

How do I go about creating my own taskbar toolbar, a la Windows Media Player: Examples or documentation or even open source software that implements this for just about any language would be appreciated, but Google isn't being very helpful. Ultimately, I would like to do this in C# (I expect to need P/Invoke) for XP onwards, but any l...

Using a var based on an enum in a Where clause in Entity Framework throws an exception.

I have the following code which throws an exception (detail in code comments below). I am merely trying to use an instance of an enum as part of the Where clause. I understand the message, but I don't understand why EF cannot parse an Int32 enum. It works if I copy the enum to an Int32 and then filter on that, but it seems very messy. ...

Any ready-made implementation of Radix Sort for C#?

Preferrably with any non-virus open source license ...

C#: What does MissingManifestResourceException mean and how to fix it?

The situation: I have a class library, called RT.Servers, containing a few resources (of type byte[], but I don't think that's important) The same class library contains a method which returns one of those resources I have a simple program (with a reference to that library) that only calls that single method I get a MissingManifestRe...

how to convert text to rtf, for sending email?

Since I need to send email by code, I'm currently using plan text but since outlook, by default, remove the extra line break it screw up my formatting and I don't want that, I tried to put my text into html but now the email is marked as spam. My last choice is to move the text into rtf but now my question is. What is the easiest way t...

Linq to Xml query

I have a xml structure like this: <Items> <Configuration> <ConfigurationSetting>Setting1</ConfigurationSetting> <ConfigurationSetting>Setting2</ConfigurationSetting> </Configuration> <MetaData> ... </MetaData> <Group> <GroupType>MyType1</GroupType> <GroupType>MyType2</GroupType> ...

Robust way to send and handle messages for a distributed system

I'm working on a small distributed system, which is completely message driven. Right now, I usually open up a socket each time I have to send something and close it right afterwards. State is only maintained on the server side (for instance, if no message arrives for 5 minutes from a client, consider it dead). However, I have to do some...

Html Generation from Xml Tree (C#/.NET)

I have an HTML document stored in memory as an Linq-to-XML object tree. How can I serialize an XDocument as HTML, taking into account the idiosyncrasies of HTML? For example, empty tags such as <br/> should be serialized as <br>, whereas an empty <div/> should be serialized as <div></div>. HTML output is possible from an XSLT styleshe...

Using Uploadify with Sharepoint and .net

I have a some html being generated by JQuery on a Share Point page. I want to use uploadify in this html to upload a file to the server. Alexander has helped by providing the following sample code which is based partially on http://www.uploadify.com/forum/viewtopic.php?f=5&amp;t=45. upload.ashx <%@ Assembly Name="ClassName, Version=1....

ColumnChangeEvent not fired for calculated columns

How can I be notified when a calculated column value changes ? ...

Winforms Datagrid, display foreing key

Hi, Currently I have a DataGrid, and a datasource. The Datasource is directly pulled from the database in this order: Id, SalaryId, Old, New Problem is that it displays the SalaryId, I want it to display the SalaryId Value How do I do this? Thanks, -Kristof ...

Inserting Rows in Relationship using a Strongly Typed DataSet

I'm using ADO.NET with a strongly typed dataset in C# (.NET 3.5). I want to insert a new row to two tables which are related in an 1:n relation. The table Attachments holds the primary key part of the relation and the table LicenseAttachments holds the foreign key part. AttachmentsDataSet.InvoiceRow invoice; // Set to a valid row, also...

Including a ASP Web Service Project in a Windows Forms Application

I have a web service that I'd like to include as a project reference inside a windows forms application. (The application will be running on non-networked hardware.) I could simply copy the *.vb files I need into my forms project, but I'd rather not fork the code base. It wasn't hard to include the ASP project in the windows forms sol...

Is it possible to send an Object's Method to a Function?

I am wondering if it is possible (and what the syntax would be) to send an object's method to a function. Example: Object "myObject" has two methods "method1" and "method2" I would like to have a function along the lines of: public bool myFunc(var methodOnObject) { [code here] var returnVal = [run methodOnObject here] [code...

Data structure for Category

I am looking for a data structure to add,remove,get,find on categories. for example: books drama science fiction other Sports Cycling Golf Team Sports soccer football etc. I think about using tree from C5 for example, but it looks like it has only red-black trees. Any suggestions? ...

Save stream to file.

I have a fileupload control that allows users to upload images but before they can upload images I want to resize thomse images to mas 640x480 size the problem is I can't figure out what to do next. This is what I have; // CALL THE FUNCTION THAT WILL RESIZE THE IMAGE protected void btnUploadFile_Click(object sender, EventArgs e) { S...

Code First .NET Web Service uses soap encoding - how can this be prevented?

How would one configure asp.net / asmx to not use soap encoding at all when generating wsdls from a .NET interface? In short, a .NET SOAP Web Service is producing a wsdl that includes soap encoding. For example: <s:schema targetNamespace="http://tempuri.org/AbstractTypes"&gt; <s:import namespace="http://schemas.xmlsoap.org/soap/enco...

.Net CMS with API to expose content

I am looking for a .Net CMS that allows me to expose pages/articles that are created in the CMS to other applications without querying the CMS database. Preferably this would be done through an API and by exposing them through a custom secured webservice. I know Sitefinity can do this. Do you know if Umbraco DotNetNuke can do th...