.net

.NET - Click-Once / Smart Client Applications - Browser Cookie Equivalent?

Is there an equivalent to browser cookies for Smart Client / Click Once application development on .NET 3.5? Some place I can store cookies on the user's machine rather than the server. Or to put it another way - what file location can you write to from a sandboxed Click-Once app that won't violate good security practices. I don't wa...

Is there a way to use ParameterInfo and PropertyInfo Interchangeably ?

To me they are very similar structures. I was hoping there was a way to cast or convert one to the other easily. I'm using reflection to do some magic. I've chosen the path to use parametrized constructors to create some user selected objects which they fill in values for the parameters using a UI. The problem is one of the objects tak...

Can I use XPath functions with XPathNavigator?

I've got an XPathNavigator at the root of a document. Several levels down, there's a group of numeric values that I want to sum. I could always loop through the nodes and add them myself, but since I knew the XPath spec included a sum function, I decided to try to use that. I'm running into an error. System.Xml.XPath.XPathException - Ex...

How can I mock Assembly?

Is it possible to mock the Assembly class? If so, using what framework, and how? If not, how would do go about writing tests for code that uses Assembly? ...

querying for local groups

I'd like to retrieve all local groups on my machine (Vista in a W2k3 domain). If I run: using (DirectoryEntry de = new DirectoryEntry("WinNT://" + Environment.MachineName + ",group", null, null, AuthenticationTypes.Secure)) { } it throws an "unknown error" 0x80005000 which apparently means "invalid path" However querying for comput...

What topics for a training class?

We have a team of developers in India. I will be visiting them for a week at the end of the month. Part of my job while I'm there is to provide them with some training. I've been code reviewing them for almost 2 years so I have a few specific things that I'd like to coach them on. My question to the SO community is this: What genera...

What happens when you return "this" from a struct in C#?

Curious, what happens when you return keyword this from a struct in C#? For example: public struct MyStruct { // ... some constructors and properties 1-3 public MyStruct Copy() { return MyStruct(Property1, Property2, Property3); } // vs public MyStruct This() { return this; } } ...

Something similar to sql IN statement within .NET framework?

I have this function: public bool IsValidProduct(int productTypeId) { bool isValid = false; if (productTypeId == 10 || productTypeId == 11 || productTypeId == 12) { isValid = true; } return isValid; } but I'm wondering if there's an easier way to...

IDispatchOperationSelector question

Hello, i built a service with a custom operation selector, the selector simply looks at a specific element in the message body ( and ignores the action) to specify which method to call on a contract. This works fine, and i can see that the server code is being invoked now, however the client throws an exception saying that the action o...

providing an asynchronous programming model: Should I? and if so, should it be VerbAsync() or BeginVerb()?

Providing Synchronous and Asynchronous versions of Method in c# asks how to provide an async version of a method. One of the answers suggests that class library developers should avoid providing the async method, if possible, based on the single responsibility principle. Is this true? Should I NOT provide async versions of methods? ...

How to Send HTTP Auth Credentials to a non .NET WebService

As far as I can tell i'm doing everything by the book, but the .NET client is simply not sending an authentication header when making requests to my (PHP) SOAP Web Service. I have verified this by logging the raw post data at the PHP end of things and .NET never sends any auth headers. This is the code I am running before making calls o...

Setting a value of an object's child property problem

Hi, I get child properties of an object with this code, PropertyDescriptorCollection childProperties = TypeDescriptor.GetProperties(theObject)[childNode.Name].GetChildProperties(); think that "theObject" variable is a TextBox and I try to set TextBox.Font.Bold = true; I use this code for main properties and it works when I customize ...

What do people want in a persistent .NET Dictionary?

I'm implementing generic, persistent .NET collections based on top of the ESENT database engine (using the ManagedEsent interop layer). So far I have been focusing on classes that exactly mimic their System.Collections.Generic counterparts, except that they take a path in the constructor indicating where the database should go. Code like...

Creating local users

I am having a bad directory day. :) Could someone tell me what is wrong with this? groupName = "Monkey"; ... using (DirectoryEntry directoryEntryObject = new DirectoryEntry("WinNT://" + Environment.MachineName, "", "", AuthenticationTypes.Secure)) { using (DirectoryEntry group = directoryEntryObject.Children.Add("CN=" + groupName....

WCF: Interfaces, Generics and ServiceKnownType

Hi guys I have the following: [ServiceContract] [ServiceKnownType(typeof(ActionParameters))] [ServiceKnownType(typeof(SportProgram))] [ServiceKnownType(typeof(ActionResult<SportProgram>))] public interface ISportProgramBl { [OperationContract] IActionResult<ISportProgram> Get(IActionParameters parameters); } When I run the ...

Conversion of C# to VB.net will not compile <param name="x"...

I cannot figure out how to convert this code from C# to VB.net. It says - Argument not specified for parameter ‘y’ in the calling code below. Any suggestions? Thanks Calling CODE: list.Sort(Utility.CompareContactListsBySortOrder) - error here in VB CODE: /// <summary> /// Defines the compare criteria for two Contact List...

Programmatically maximize an external application's window (vb .net)

I have an application right now that starts a process, then opens a file associated with that process (system.diagnostics.process.start("WM.exe")), however, the way they save, there is a window within a window. It's like in photoshop cs3 when you have many windows within the big window of the application. Right now I use an api call to f...

.NET deserialization - using different assembly

I've got a problem I can't find any solution for. I have a textfile containing Serialized objects. I need to extract that data. I have the code of class that was used to serialize and the entities but not the original assembly. I can't deserialize this because the serialization class wants the exact same assembly to deserialize as the o...

Exchange 2003 - which API to use to find out room/resource availability?

I need to expose room availability information from a web service that will be consumed by a number of other applications. The availability information is stored within Exchange 2003, and can be viewed using Outlook 2003/2007 today. What API or Web Service (if available) should I be using to get to this information? I imagine that I cou...

When to use a SortedList<TKey, TValue> over a SortedDictionary<TKey, TValue>?

This may appear to be a duplicate of this question, which asks "What’s the difference between SortedList and SortedDictionary?" Unfortunately, the answers do nothing more than quote the MSDN documentation (which clearly states that there are performance and memory use differences between the two) but don't actually answer the question. ...