.net-3.5

Accepting a limited set of subtypes in a method argument

This is with C# and .net 3.5 Let's say I have the following method: myMethod(myBaseClass mbc) In my project, all the following classes inherit from myBaseClass. ot1:myBaseClass ot2:myBaseClass ot3:myBaseClass ot4:myBaseClass Are there any tricks that will let me use myMethod with ot1 and ot3 but NOT ot2 and ot4, or do I basically ...

Is there a way to generate(emit) code at runtime in medium trust?

I would like to know if there is something similar to CSharpCodeProvider, but it should work in ASP.NET Medium Trust, anyone knows a good one? [EDIT 08-25-2009] Why I want to do that? I was writing a simple tutorial about Link to Objects and I would like users could write some simple querys on a textbox, post it to server to see the ...

How can I create a custom *write-only* dependency-property?

I need to know what the procedure is for making a write-only dependency-property. I can see that the DependencyProperty class does not have a special "Register" method for write-only properties, but I have no idea whether the RegisterAttached method may apply to what I am trying to do. This property needs to be a dependency-property, ...

how to make GridView edit link calls javascript function?

I have a grid view populating by users, i want to add to it a link which will call a javascript function "showUser({userid})". I wrote it like this: <asp:TemplateField> <ItemTemplate> <a href="javascript:ShowUser(<%# Bind('UserId') %>)" runat="server" >Edit</a> </ItemTemplate> </asp:Tem...

How can I calculate the logical width of WPF visual element?

I need to calculate the logical width of a visual element, before it gets rendered by WPF. For simplicity of explanation, I'll say that this visual element will likely be a Polygon object. It could be something else, but a Polygon makes it easy to visualize. So the XAML might look something like this: <Window x:Class="MyCLRNames...

I have two problems, one of them is a regex

I am updating some code that I didn't write and part of it is a regex as follows: \[url(?:\s*)\]www\.(.*?)\[/url(?:\s*)\] I understand that .*? does a non-greedy match of everything in the second register. What does ?:\s* in the first and third registers do? Update: As requested, language is C# on .NET 3.5 ...

Keyboard focus vs logical focus in WPF

What is the difference by Keyboard focus and logical focus in WPF? and how WPF focus is different from the focus in winform ? ...

Can i use Paint.NET API to embedd it in Winforms application?

I'm trying to let the use crop a selected area from picture in my winforms application and thought to embed the Paint.NET and limit its functions. I understand that Paint.NET API is unavailable.. I'll be happy to get recommendation for another tool i can use to crop images in Winforms application. Thanx. ...

How should I create an algorithm for the centroid of any System.Windows.Media.Geometry object?

I plan on having to split up the Geometry object into a series of simpler shapes, and combine their centroids using this formula: Mathematical details of this formula can be found in this Wikipedia article. NOTICE: Don't be suprised if my view of the mathematics is incorrect. I haven't done any complex math past trigonometry, and I'v...

CrossDomainError on same domain

Hello, I'm learning to build Silverlight 3 apps using WCF to communicate with the back end. We are going to deploy to IIS7 on Server2008 or Vista. The client binaries as well as the web service binaries are all located in the same IIS web directory. When I hit the service front page (http://localhost/MyService.svc) it returns just fi...

Using NUnit with .NET 3.5

Does NUnit work with .NET 3.5? i've the page says it's for .NET 2.0... ...

How do I pass reference types between webservices?

I'm having a bit of difficulty passing a reference type between webservices. My set up is as follows. I have a console application that references two web-services: WebServiceOne WebServiceTwo WebServiceOne declares the details of a class I am using in my console application...let's call it MyClass. My console application calls We...

How can I make sure only one WPF Window is open at a time?

I have a WPF window that I am launching from inside of a winform app. I only want to allow once instance of that WPF window to be open at a time, and not warn that user if they try to open it again. I am having a problem however trying to search for that WPF window being open because the window is being launched from a winform. What I n...

Creating partial methods on compiled LINQ->SQL class...

Hey Everyone -- If I want to compile my LINQ->SQL classes into a DLL to provide to my developers, how can I make it so that they can still hook into the various entity partial methods (OnValidate, for example)? I know that you cannot implement partial methods on a compiled assembly, but any suggestions on how I can extract this behavio...

Caching object in Application_AuthenticateRequest

Is there any user specific caching object available inside the Application_AuthenticateRequest? I've notice Session and Cache are not available. I'm using .net framework 3.5 and aspx. ...

BadImageFormatException when attempting to use LuaInterface

I imported LuaInterface into a console project, referenced it, and wrote a small test script. When i run it, i get this: Could not load file or assembly 'LuaInterface, Version=2.0.0.16708, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. Forgive me for be...

What would be the simplest way to implement Flexigrid with ASP.NET 3.5?

I've been trying to follow the top Google results for ASP.NET + Flexigrid for jQuery such as CodeProject's approach but they all seem kind of sophisticated, I'm rather looking for something way more basic in terms of simplicity, a kind of Hello World approach if you will. I'd be more than happy if you guys would like to share any resour...

Reading Access MDB file from ASP.NET 3.5 Web Service on 64 bit OS.

I run Windows Server 2008/IIS 7. From a Web Service I attempt to read from a local mdb file. If I set the target platform to any or x64 I get the error: The 'Microsoft.JET.OLEDB.4.0' provider is not registered on the local machine. If I set the target platform to x86 I get the error: An attempt was made to load a program with an inco...

Explanation why IEnumerable is more efficient then a List

I keep hearing that in .net 3.5 you should use IEnumerable over a List, but I can’t find any reference materials or articles that explain why it’s so much more proficient. Does anyone know of any content that explains this? The purpose of asking this question is to get a better understanding of what IEnumerable is doing under the hood...

Can you use .net 3.5 Action or Func as Marshalled unmanaged delegates?

After reading Dynamically calling unmanaged dlls in .net I've been trying to modify the code to my liking. I made a class that implements idisposable to wrap load calls in and free them when needed. However I can't seem to figure out the syntax if it is possible to use anonymous delegates with it. var loaded=DynamicLibraryLoader.TryLo...