.net-4.0

Adding members to a dynamic object at runtime

I am exploring the DynamicObject model in .NET 4.0. The application is one where an object will be described through some sort of text/xml file, and the program must create an object upon reading that file. With DynamicObject, we can add members easily, given that we know the name of the member a priori. But, what if we don't even know ...

Working with C# Anonymous Types

Hello I am calling a method that returns a List variable that contains a c# Anonymous Type objects. For example: List<object> list = new List<object>(); foreach ( Contact c in allContacts ) { list.Add( new { ContactID = c.ContactID, FullName = c.FullName }); } return list; How do I reference this type propert...

C# to Vb.Net Syntax conversion for class instantiation with properties

Ello, Working with Workflow Foundations 4 (in C#) and trying to write a VB expression Is there a way to do the following in VB.Net on one line? SomeObj instance = new SomeObj() { SomeStringProp = "a", SomeIntProp = 17 }; ...

How do I get the silverlight view page name and querstring from silverlight code behind?

VS2010 w/Ria Services & SL4. I already have my SL app loaded in the browser. User clicks around to different view pages and I would like to store their current location in a list of "recently visited pages". To do that, I need to store the view page + any existing querystring key/values. Ex: here is a real page in my sl app: http://...

New project for ASP.NET MVC 3 Beta not including unobstrusive validation Javascript files

My problem today is rather simple, but its driving me nuts! I just downloaded and installed the ASP.NET MVC 3 Beta and created a new project using VS 2010. But when I check the scripts folder, there are none of the following files there! (from what I understood, they should be there): · /Scripts/jquery.unobtrusive-ajax.js · /Scripts/jq...

Getting the connectionstring in .net 4

I want to get a connection string from the app.config file. connectionString = System.Configuration.ConfigurationSettings.AppSettings["DBEntities"]; But it doesnt work. It's empty. I cannot access the System.Configuration.ConfigurationManager because it's .net 4. How can i get my connection string from the app.config? Thanks ...

Textbox with "new line"

We tried several ways to make a textbox to accept the "enter", newline, etc.. But we are still facing the same problems. Most of the "Third party" controls allow the user to format the text as he wants. Eg, add color, font, table, etc.. However, for most stylish websites, we do not want to allow the user to format the text that way. But...

VisualState that starts collapsed interfers with other animations in WPF .NET 4

I am using .net 4, vs2010 and have created a user control that needs to start collapsed and transparent (opacity 0) and become visible and opaque in response to a button click. <UserControl x:Class="Ihi.LeadRetrieval.Client.Views.HelpView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...

How can I change the color of each character in a textblock

I am writing a little diff tool and need to be able to change the color of a character depending on if its the same, added, removed. What would be the best way to handle this? Is a textblock a good control to start with? ...

IronRuby doesn't recognize 'rake' - I'm getting undefined method `rake' for main:Object, how to fix?

Hi All, Just installed IronRuby 1.1. I'm trying to take a look at rake and albacore. After installing ironruby, I am able to hit a command prompt by typing ir, and I am able to do simple puts, but when I try to run rake, I get the error undefined method `rake' for main:Object How do I resolve this? Any ideas? Thanks, ~ck in San D...

WPF Ribbon's application menu alignment: bug or programmer error?

I'm using WPF 4's (in .NET 4) ribbon control, version 3.5.40729.1, in my application. (Edit: I also tested the newly released version 4.0.0.11019 to no avail.) The application menu and all sub-menu popups align as far left as possible, usually far outside the ribbon window. The expected location is that the application menu's left edge a...

handling execptions on tasks on .net 4.0

i'm getting an odd execption on task creation in .net 4.0. i'm getting the exectpion on windows service with a Global Updomain unhandled execptions handler so i don't have the exact stack-"A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property." i think it occurs on the following code se...

c# .net4 VisualStyles is there a way to make a forms controls to look as they do on Vista/win7 under XP?

Hi I have a form that uses checkbox with the appearance set to button and it works well and looks good on Win7 but on XP it doesn't, you cannot tell if they are up or down... so can I make the form look as it does on W7 regardless of which OS its running on? I have tried this.EnableVisualStyles = true; and setting it to false make...

What has improved in .NET 4.0 Threadpooling?

I am reading a C# 4.0 book which gives the following default values for the maximum thread limit for the threadpool. 1023 in Framework 4.0 in a 32-bit environment 32768 in Framework 4.0 in a 64-bit environment 250 per core in Framework 3.5 25 per core in Framework 2.0 Can anyone tell me what might might have prompted such a vast incr...

UIP Application Block in .NET 4

Hi guys, I am involved in migrating a legacy application built in .NET 1.1 to .NET 4. Is UIP (User Interface Process) still available in the latest released of EnLib 5? If no, what are my options? Regards, Karan Misra ...

Get path of a Solution Item file in Visual Studio Add-In

I'm iterating through a solution and its projects and items and need to retrieve the path to the items on disk. I can retrieve the project file name from Project.FullName and can get a project items path using ProjectItem.Properites.Item("FullPath"). However, for an item in the solutions 'Solution Items' folder, the items Properties m...

Entity Framework 4.0 - Versioning

Is this possible to implement with EF4.0? I have used NHibernate in the past and you can flag a timestamp column as a 'Version' column and it will enforce concurrency. Does this feature exist for EF4.0? If it does, are there any resources on how to set this up? If it does not exist, what alternatives do I have to handle 2 users editing ...

Well-Known Metadata + Wildcards in MSBuild 3.5

Hi guys, I'm currently trying to use MSBuild to set up a project, and am having some issues with wildcards. I'm trying to use the following snippet: <Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; <ItemGroup> <Xsd Include="App_Data\*.xsd"> <Generator>MSDataSetGenerator</Generator...

How can I pass an instance of a .NET COM object from Delphi to another .NET COM object?

I have a legacy app written in Delphi 7. We are adding new modules to the app. The modules are written in Visual Studio 2010, .NET 4, C#, and exposed to the app through COM. I have successfully defined a class, registered the assembly, exported the type library, imported the type library into Delphi, created the COM client in Delphi a...

Source property on ResourceDictionary gets assigned late under .NET 4 vs. .NET 3.5

I have an application that loads a series of resource dictionaries programmatically at startup. I have derived AdvancedResourceDictionary from ResourceDictionary and I set its Source property to a XAML file containing an AdvancedResourceDictionary object, like so: var ard = new AdvancedResourceDictionary(); ard.Source = new Uri("/Sandb...