.net-4.5

Find multiple controls with by partially matching their name

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 01:40:44
问题 I currently have 100+ labels, with names like: labelNumber1 labelNumber2 labelNumber3 labelNumber4 .... labelLetter1 labelLetter2 labelLetter3 labelLetter4 .... How would I find all the labels that have "Number" in the controls name? Instead of having to type out labelNumber1.text = "hello", etc. I have tried regex and foreach with wild cards but did not succeed. I have looked on msdn.microsoft.com about using regex with a control. 回答1: You can loop through the Controls collection of the form

Visual Studio 2015, Microsoft Fakes and System.Security.Claims.Claim

北城余情 提交于 2019-12-20 01:38:11
问题 I have an interface in a .NET 4.5 (not 4.6) class library, public interface IBrokenFakeInterface { Claim WhyWontItGenerateFakeOfThisInterface(); } In my unit test project (MSTest) when I have added the Fakes for the appropriate assembly containing this interface, I get compiler warning that says it cannot generate the stub. Warning: Cannot generate stub for ClassLibrary1.IBrokenFakeInterface: method System.Security.Claims.Claim ClassLibrary1.IBrokenFakeInterface

What is the stack size of a BackgroundWorker DoWork Thread? Is there way to change it?

人走茶凉 提交于 2019-12-19 10:18:43
问题 I know for a C# main program the stack size 1 MB (32-bit and any) or 4 MB (64-bit), see Why is stack size in C# exactly 1 MB? What is the default stack size of the BackgroundWorker DoWork thread? Is there a way to change the stack size of the BackgroundWorker DoWork thread beside creating another thread like the following example: private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { Thread thread = new Thread(delegate() { // do work with larger stack size }, 8192 * 1024);

Use wsse security header in soap message (Visual Studio 2015, .Net Framework 4.5)

为君一笑 提交于 2019-12-19 09:43:10
问题 I would like to consume a Soap Service provided by DHL. You can find the wsdl here: https://wsbexpress.dhl.com/sndpt/expressRateBook?WSDL Therefore I created a new ClassLibrary in Visual Studio 2015 targeting .net framework 4.5. Then I added a Web Reference to the created project by providing the wsdl address. I generated a proxy file with all types and ports in it but my first problem is, that the generated Service extends from System.Web.Services.Protocols.SoapHttpClientProtocol . As I read

App_Global.asax.compiled and App_Global.asax.dll missing? WebApi .NET 4.5 project

霸气de小男生 提交于 2019-12-19 09:16:14
问题 During our adventures of building a 'simple' API using WebAPI we've had our fair share of issues as any project does, however I am unable to find any such resource that can explain the following behavior: Details : Visual Studio 2013 with Update 2 (however, before updating, this was the same) Windows Server 2008 R2 Web API 5.1.2 The issue seems to be related to the "Publish" command, specifically the "Precompile" option. When running via IIS Express, we see no issues at all. If we publish

Why would FederatedAuthentication.WSFederationAuthenticationModule be null in MVC Azure ACS Federated Authentication?

青春壹個敷衍的年華 提交于 2019-12-19 08:50:37
问题 I'm trying to put together FederatedAuthentication with .NET 4.5, MVC 4, and active redirect using a custom server-side login page, using code from this tutorial, and from this code sample. Redirecting to the LogOn method of my AccountController works fine, and the method looks like this: public ActionResult LogOn() { HrdClient hrdClient = new HrdClient(); WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule; /*** Fails here because this is null **/

How can I set User-Agent and Referer headers when using ClientWebSocket in .net 4.5?

笑着哭i 提交于 2019-12-19 08:50:26
问题 The obvious answer of using ClientWebSocket.SetHeader throws an exception because it's a protected header: System.ArgumentException occurred Message=The 'User-Agent' header must be modified using the appropriate property or method. Parameter name: name ParamName=name StackTrace: at System.Net.WebHeaderCollection.ThrowOnRestrictedHeader(String headerName) The exception string suggests using a property/method on the ClientWebSocket itself but I can't find any such property/method. It seems this

Virtualizing Panel that doesn't crop items

一世执手 提交于 2019-12-19 08:10:27
问题 So, it looks really silly to have a chrome-less collection if the items are getting cut/cropped at the end of the scroll region. I want to create a virtualizing panel for collections (ItemsControl/ListBox) that only draws whole items, never pieces of items. For example: ______________ | | |______________| ______________ | | |______________| ______________ | | I don't want the 3rd partial container to be displayed unless there is room for the WHOLE item/container to be displayed. In the

Is it possible to use the .NET DeflateStream for pdf creation?

孤街浪徒 提交于 2019-12-19 08:00:12
问题 I'm playing around with the ability to create pdf files through C# code. I have been looking at the PDF specifications and have been able to create a working PDF file, done by taking strings of data and encoding them into byte arrays using the UTF8 Encoding. The problem I run into is when I try to use the DeflateStream on the pdf stream objects. It just doesn't seem to work: Here is the text version of the pdf object that is in question ( \r\n is at the end of each line, just not visible here

Does Volatile.Read / Volatile.Write for “double” atomic?

女生的网名这么多〃 提交于 2019-12-19 07:35:25
问题 MSDN states that long, ulong, double, and decimal, as well as user-defined types, are not guaranteed to be atomic 5.5 Atomicity of variable references Will Volatile.Write Method (Double%, Double) work as atomic operation? If so how this is guaranteed? Is it safe to do Volatile.Write(ref mydouble, value); in one thread and Volatile.Read(ref mydouble) in another where mydouble has double type? That was general question. Another question - what should I do in this particular situation: 2