Questions tagged [.net-4.5]

Version 4.5 of the Microsoft .NET Framework. Use for questions specifically related to .NET Framework 4.5. For questions on .NET Framework generally, use the .net tag.

Reference

3775 questions
2
votes
2 answers

Random number Generation with Seed

If I am using the Random class in .Net(4.5) and I am always using the same seed to generate 1000 numbers is there a chance that on a different machine (with diff chipset / number of cores, etc) that my 1000 numbers could be different? I don't see…
scarpacci
  • 8,957
  • 16
  • 79
  • 144
2
votes
2 answers

async foreach with breaking condition

I have an interface: public interface IRunner { Task Run(object o); } and I have some classes that implement it using async, for example: public class Runner1 : IRunner { public async Task Run(object o) { var num =…
Alon
  • 353
  • 1
  • 10
2
votes
0 answers

Entity Framework 5.0 TBH multiple level abstract inheritance hierarchy not saving properties into databse

I have a two level heirarchy of inheritance defined in my EF5 edmx file. A simple example of the class structure: A -> B A -> C A -> D -> E A -> D -> F Where bold classes are abstract (mustinherit). Class A defines several properties that are used…
2
votes
1 answer

Metro Application connects to SQL via WCF Service - Error

I have created a new metro application for Windows 8. My intention was to consume data from the WCF data service in the metro application. The WCF service should connect to a SQL server installed on the local machine. I have set up an Interface for…
Noxissist
  • 21
  • 1
2
votes
2 answers

How to make a password protected file in C#

I know this question has been asked before but the answer simply wasn't what I needed. I need to create a password protected text file. I don't mean to encrypt but just create a file with a simple text password. It would also be nice to find out how…
ThatGuyJay
  • 307
  • 2
  • 5
  • 13
2
votes
1 answer

How to decode SessionSecurityToken

Is it possible to decode a SessionSecurityToken? I've set up a site to work with ThinkTecture IdentityServer using MachineKeySessionSecurityTokenHandler, and everything works as expected. But now I need to pass the token to another service, but in…
2
votes
2 answers

C# .net 4.5: Generic class inheriting from List with a where constraint

Working on a big project, I realized the following snippet : public interface Mother { void CoolFeature(); } public interface Daughter : Mother { } public class YouJustLostTheGame : List where T : Mother { public void Crowd(Mother…
Geod24
  • 883
  • 6
  • 14
2
votes
1 answer

wpf datagrid rowdetail is cut off

I have a WPF datagrid that changes the rowdetails datatemplate based on the combobox selection of one of the columns(action column). One of the rowdetails template is large and the space provided for the datagrid cannot fully display the…
J King
  • 4,108
  • 10
  • 53
  • 103
2
votes
2 answers

How to get rid of app.config and move it all into code?

I tried this question in a generic way on this post: https://stackoverflow.com/q/18968846/147637 But that did not get us to the result. Soooo, here it is concretely! I have the code below. It works. In VS, you add a web reference, code up the below,…
Jonesome Reinstate Monica
  • 6,618
  • 11
  • 65
  • 112
2
votes
1 answer

Stuck in a Authentication redirect loop - STS/WIF

Using VS2012 .Net Framework 4.5, I created a WCF Service Application with Local STS, using Identity and Access Plugin. My goal is to be able to authenticate using the browser. What I did so far: Added WSFAM and SAM modules. Used Fiddler to make…
2
votes
1 answer

How to convert a DataReader to a DTO/List properly?

I'm trying to find an easy way to convert a DataReader to a DTO (wich got properties just like the column names). But I'm wondering how the reflection would affect the performace and maybe there's an easier/cleaner way to do it. I was looking at SO…
Alexandre
  • 395
  • 3
  • 5
  • 17
2
votes
1 answer

What are the advantages of using ETW EventSources versus regular EventLog API?

We are currently investigating replacing the logging on our system. In many places we are already using the regular EventLog API which auto creates the Event Source if one doesn't exists. I'd like to know how much benefit there is to converting our…
jaffa
  • 26,770
  • 50
  • 178
  • 289
2
votes
4 answers

How to implement "retry/abort" mechanism for writing files that may be used by another process?

This is really short question. I don't understand try-catch mechanism completely. This is my current code: public static void WriteText(string filename, string text) { try { System.IO.StreamWriter file = new…
Kamil
  • 13,363
  • 24
  • 88
  • 183
2
votes
0 answers

C# WebSocket simplest app not working, how to trace?

I wanted a very simple WebSocket sample in .NET 4.5 but haven't been able to get any examples/tutorials working. I'm beginning to think it's actually my system rather than the samples (some of them are out of date, referencing W8 RC, for example).…
GeoffM
  • 1,603
  • 5
  • 22
  • 34
2
votes
3 answers

Is it possible to reference an assembly that targets .net 4.5 in a project that targets 4.0?

I have a MVC 3 application that targets .net 4.0 It has a dozen or so projects also targeting .net 4.0 I have created a new project for the solution targeting .net 4.5 that uses reflection (there are a couple of nice bits of functionality in 4.5…
atreeon
  • 21,799
  • 13
  • 85
  • 104