.net-4.0

Show files from 2 different folders in a single Gridview

て烟熏妆下的殇ゞ 提交于 2019-12-31 05:25:13
问题 Is it possible to show files from 2 different folders (c:\test1 and c:\test2) in the same gridview? I work in VB.net (VS 2010) Thanks! 回答1: Yes. Get list of all the files using Directory.GetFiles() into a single IEnumerable<string> and bind it to a GridView. This is how you'll do it in c#. List<string> allFiles = new List<string>(); allFiles.AddRange(Directory.GetFiles(@"C:\test1\*")); allFiles.AddRange(Directory.GetFiles(@"C:\test2\*")); yourGV.DataSource = allFiles; yourGV.DataBind(); 回答2:

Simplified WCF configuration on server and client

蹲街弑〆低调 提交于 2019-12-31 04:46:07
问题 We are in the process of migrating legacy .Net Remoting services to WCF. After reading on the subject for a while, I stumbled upon this metadata talk and building proxies dynamically on the client: it seemed promising. What I wanted to achieve, if possible, is to expose the services on one web application with minimal configuration (i.e., no explicit <services> node on the config file), and build the proxies in the client (by sharing the interface) also with minimal configuration. I know it

Does .NET define common HRESULT values? [duplicate]

落花浮王杯 提交于 2019-12-31 04:22:34
问题 This question already has answers here : HRESULT Enumeration C# (4 answers) Closed 4 years ago . I'm creating a COM class in C#, which will be called from unmanaged C++. I want to use ThrowExceptionForHR but I'd rather not have to hard-code HRESULT numeric values. I was expecting there would be some enum of common HRESULT values in .Net somewhere? Put another way, where can I find named symbols which map to HRESULT values to pass into ThrowExceptionForHR ? Update: MS talk about it in this

.net 4 xslt transformation Extension Function broken

风格不统一 提交于 2019-12-31 03:36:06
问题 I'm in the process of upgrading an asp.net v3.5 web app. to v4 and I'm facing some problems with XSLT transformations I use on XmlDataSource objects. Part of a XSLT file: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:HttpUtility="ds:HttpUtility"> <xsl:output method="xml" indent="yes" encoding="utf-8"/> <xsl:template match="/Menus"> <MenuItems> <xsl:call-template name="MenuListing" /> </MenuItems> </xsl:template> <xsl:template name="MenuListing"> <xsl

Unable to open download save dialog

拈花ヽ惹草 提交于 2019-12-31 02:58:14
问题 Using the below code I am unable to show the open/save as file dialog: public void ProcessRequest(HttpContext context) { string link = context.Request.QueryString["Link"]; string extension = Path.GetExtension(link); string fileName = Path.GetFileName(link); string fullPath = String.Format("{0}\\{1}", context.Server.MapPath("~/Content/Uploads/"), fileName); if (File.Exists(fullPath)) { context.Response.ClearContent(); context.Response.ClearHeaders(); context.Response.AddHeader( "Content-Length

Visual Basic Command Line Compiler has stopped working

不打扰是莪最后的温柔 提交于 2019-12-31 01:57:28
问题 Yesterday, I could work with Visual Studio 2010 without any problem. However, today after I turned on the computer and tried to open my project (Web application with Visual Basic.NET) on VS2010 again, I got a message box showing as below: Later, I found out after I tried deleting suo file that this message box will show up whenever I open some file in Visual Studio so I tried to run the application. Then, I found another message box popped up as below: And after I close the message box, I

can .net framework 4 works on top of windows xp?

会有一股神秘感。 提交于 2019-12-31 01:27:25
问题 I tried to run a small application that I've written using VS2010 on my old Windows XP desktop. I got the yellow screen of death showing me a portion of the web.config with assemblies. <compilation debug="true" targetFramework="4.0"> It looks like it didn't like the 4.0 framework. I re-wrote it, targeting 3.5 framework, this time it worked perfectly. I'd like to know if I can install .net framework 4.0 on top of Windows XP? Thanks for helping 回答1: The system requirements indicate that Windows

WPF CommandParameter MultiBinding values null

怎甘沉沦 提交于 2019-12-30 18:29:32
问题 I am simply trying to bind two controls as command parameters and pass them into my command as an object[] . XAML: <UserControl.Resources> <C:MultiValueConverter x:Key="MultiParamConverter"></C:MultiValueConverter> </UserControl.Resources> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal"> <Button Name="Expander" Content="+" Width="25" Margin="4,0,4,0" Command="{Binding ExpanderCommand}"> <Button.CommandParameter> <MultiBinding Converter="{StaticResource

How to convert an IEnumerable<Task<T>> to IObservable<T>

你说的曾经没有我的故事 提交于 2019-12-30 17:26:23
问题 Is there a built in way to convert an IEnumerable<Task<T>> to an IObservable<T>. Order doesn't matter, just that I get things, though preferably as they're completed. If it doesn't exist yet, what might be a good way to accomplish it? 回答1: I believe this will work tasks.Select(t => Observable.FromAsync(() => t)) .Merge(); Each task will send its results to the observable sequence in whatever order they complete. You can subscribe to the sequence and do whatever you want with the results that

Compilation error in .NET 4.0 web.config - Linq not found

泄露秘密 提交于 2019-12-30 17:06:47
问题 I can compile and test my .NET 4.0 web application just fine within Visual Studio 2010. If, however I point my local IIS to the folder containing the application, I get the following error: Compiler Error Message: CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) Source Error: Line 388: <add namespace="System.ComponentModel.DataAnnotations" /> Line 389: <add namespace="System.Configuration" /> Line 390: <add namespace=