.net-3.5

Using a Cross Thread Boolean to Abort Thread

Possible Duplicate: Can a C# thread really cache a value and ignore changes to that value on other threads? Lets say we have this code: bool KeepGoing = true; DataInThread = new Thread(new ThreadStart(DataInThreadMethod)); DataInThread.Start(); //bla bla time goes on KeepGoing = false; private void DataInThreadMethod() { ...

Is there a .NETCF 3.5 SP1? or is it still at just 3.5?

Does the .NET Compact Framework have a service pack? If so does anyone know where the redist download is? I found this: http://www.microsoft.com/downloads/details.aspx?FamilyID=E3821449-3C6B-42F1-9FD9-0041345B3385&displaylang=en But it is just for 3.5. I think that is current, but I don't want to get burned by setting up older st...

Excel 2007 VSTO plugin exception when setting Font.Color

Hello all, I am working on an Excel 2007 VSTO plugin that is throwing COM exceptions on the client but not when debugging on my development machine. What the plugin does is capture Excel's Startup event, define a specialized style, then add an event handler to the SheetChange event. Anytime a value is changed in the sheet, the cell is...

How to pass start parameters to workflow through WCF

It's possible to define some start values to an workflow using WorkflowInstance.CreateWorkflow, like this: using(WorkflowRuntime runtime = new WorkflowRuntime()) { Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("First", "something"); parameters.Add("Second", 42); WorkflowInstanc...

DataContractJsonSerializer produces list of hashes instead of hash

I would expect a Dictionary object of the form: var dict = new Dictionary<string,string>() { {"blah", "bob"}, {"blahagain", "bob"} }; to serialize into JSON in the form of: { "blah": "bob", "blahagain": "bob" } NOT [ { "key": "blah", "value": "bob" }, { "key": "blahagain", "value": "bob"}] What is the reason for what app...

WinForms - How do I access/call methods in UI thread from a separate thread without passing a delegate?

Hi, QUESTION: In .NET 3.5 WinForms apps, how do I access/call methods in UI thread from a separate thread, without passing a delegate? EXAMPLE: Say I have some code I want to run both (a) manually when the user clicks a button, and (b) periodically called by a process which is running in a separate non-mainUI thread but without passing...

Problem with TimeZoneInfo.ConvertTime: missed the Daylight Saving switch.

My web app runs on .Net 3.5, all of the dates are saved on the DB in UTC time (not in user time). When I want to display a date I convert it to user date (from UTC) //Get the current datetime of the user exp: GMT TO ISRAEL +2 public static DateTime GetUserDateTime(DateTime dateUTC) { string userTzId = "Israel S...

ID not recognized in .ascx page

I have the following code: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DurationPicker.ascx.cs" Inherits="Permias.DurationPicker" %> <%@ Register TagPrefix="Club" Namespace="ClubSite" %> <div class="controlblock"> <table> <tr> <td> Start Date: </td> <td> ...

VS2008 CR report viewer. Print and Export to PDF is not working

I've a web project in VS2008. The problem is that from a web report viewer; report is not getting printed or exported to pdf. Report is being shown alright but when print button or export button is pressed, nothing happens. No errors or crash. Just nothing got happened. Default printer is set alright and I am able to print from that mach...

Casting Type array to Generic array?

The short version of the question - why can't I do this? I'm restricted to .NET 3.5. T[] genericArray; // Obviously T should be float! genericArray = new T[3]{ 1.0f, 2.0f, 0.0f }; // Can't do this either, why the hell not genericArray = new float[3]{ 1.0f, 2.0f, 0.0f }; Longer version - I'm working with the Unity engine here, alth...

.NET Framework - features in 4.0 that's better than 3.0

Possible Duplicate: What features are people looking forward to in .Net 4.0 - 4.1 Hi folks, i would like to know what is it that motivated you to move to .net 4.0 from earlier frameworks? What specifically could be done better & what was the scenario? TIA ...

How to enforce xml serialization through an interface?

Currently i have some interfaces (stripped down for here): public interface IJobGroup { string Name { get; } IEnumerable<IJobItem> Jobs { get; } } public interface IJobItem { string Name { get; } void Start(); event EventHandler Finished; } Also i made some implementations of these interfaces. But now i'd like to ...

Active Directory Services: PrincipalContext -- What is the DN of a "container" object?

I'm currently trying to authenticate via Active Directory Services using the PrincipalContext class. I would like to have my application authenticate to the Domain using Sealed and SSL contexts. In order to do this, I have to use the following constructor of PrincipalContext (link to MSDN page): public PrincipalContext( ContextType ...

How do I return the first string variable that isn't null or emtpy

If I have 5 String variables and between 0 and 5 of them are null or empty is there an easy/short way of returning the first one that is not null or empty? I am using .NET 3.5 ...

Returning Index in Enumerable Select

I have a List<MyClass> with 2 items which have a SequenceNumber property. If I use this code below the returned index is 0 not 1: var test = TrackingCollection .Where(x => x.SequenceNumber == 2) .Select((item, index) => new { ...

Help with Custom Workflow that monitors an objects state

I need to write a workflow that monitors the status of an object. (It could wait for days or hours for a state to change) I have the following states for the object (lets call it an Issue object): 1) Created 2) Unowned 3) Owned 4) UnAssigned 5) Assigned 6) In Progress 7) Signed Off 8) Closed I would also need to take some action on a...

Library development - looking for valid use cases for suggested feature

I'm contributing to a library called Fasterflect whose purpose is "improving the developer experience of using reflection". As such, it provides an abstraction built on top of classic reflection and would be used in exactly the same scenarios. The following shows the current syntax for accessing members via an object instance: obj.SetP...

How do I modify my WCF service to work with ASP.NET pages?

I created a WCF service (.NET 3.5) that grabs data from a db and returns a list of objects. It works just fine. I tested it using the WCFTestClient application and got the desired results. Now, I tried to create an ASP.NET web application and consume the service. After enabling <serviceDebug includeExceptionDetailInFaults="true"/> in th...

Tell LINQ Distinct which item to return

I understand how to do a Distinct() on a IEnumerable and that I have to create an IEqualityComparer for more advanced stuff however is there a way in which you can tell which duplicated item to return? For example say you have a List<T> List<MyClass> test = new List<MyClass>(); test.Add(new MyClass {ID = 1, InnerID = 4}); test.Add(new ...

Instructing a generic to return an object of a dynamic type

This question is sort of a follow-up to my original question here. Let's say that I have the following generic class (simplifying! ^_^): class CasterClass<T> where T : class { public CasterClass() { /* none */ } public T Cast(object obj) { return (obj as T); } } Which has the ability to cast an object into a s...