Quantcast
Channel: User DaveShaw - Stack Overflow
Browsing index pages (45 articles)

Image may be NSFW.
Clik here to view.

Answer by DaveShaw for Visual Studio Code: How to show Overloads in...

When at that stage you can just press ( and it will prompt you for the overloads.Take this example:I press ( and I get:If I happen to change focus, I can go back into the call at this.M1( and press...

View Article


Answer by DaveShaw for How can I show 'git blame' in Visual Studio 2013?

TFS (and so does Visual Studio) uses the term "Annotate" instead of "Blame". Just right-click on the editor when you have a file open, then click Source Control, Annotate.I'm sure there are other ways...

View Article


Image may be NSFW.
Clik here to view.

Answer by DaveShaw for Multiple "Value" queries in TFS 12.0

You can use In to search for any value in a delimited set. Separate values with the list separator that corresponds to the regional settings that are defined for your client computer. For example, you...

View Article

Answer by DaveShaw for Should I make a private method public just for testing?

You could test it as it is.Just create your own version of orderRepository.Here's an example of a very crude API, alter to your preference (or use Moq if you are that way inclined).// The Test//...

View Article

Answer by DaveShaw for Convert IEnumerable to another IEnumerable C#

The long hand way is using LINQ's .Select extension method on IEnumerable<T> to project one the items from one collection into another:IEnumerable<CarEntity> carEntities =...

View Article


Answer by DaveShaw for Checking for uninitialized DateTime properties?

You could change the DateTime to DateTime? then they can be null, which seems to be the most accurate representation of what you want (a date that can have no value).Then you...

View Article

Answer by DaveShaw for Assigning a value to an instance of a class in C#...

You can add an implicit (or expicit) operator to your class like so:public static implicit operator ComplexNumber(int i) => new ComplexNumber(i, 0);That will allow you do what you want.As you used 2...

View Article

Answer by DaveShaw for Object reference not set to an instance of an object,...

It is most likely .InnerException that will be null. Not all exceptions have one.You should only need to log ex.ToString() and the InnerException and StackTrace will be logged as part of that...

View Article


Answer by DaveShaw for How to force a WinForms control to fill up...

You can't really Dock inside a flow layout panel, it makes no sense.A flow layout panel is used to contain a collection of controls that flow together (left to right, top to bottom), having one control...

View Article


Answer by DaveShaw for possible null reference return c# linq

The method returns a Task<Pie>.The return ... has SingleOrDefaultAsync(...) at the end which means if it cannot find an item with a matching id it will return default(Pie) which will be null.You...

View Article

Image may be NSFW.
Clik here to view.

Answer by DaveShaw for Visual Studio (Community): How do I change the...

Right click on the Project in the Solution Explorer Window and select "Set as Startup Project"

View Article

Answer by DaveShaw for How to create CTE which uses another CTE as the data...

You can chain 2 (or more) CTE's together.For examplewith ObjectsWithA as( select * from sys.objects where name like '%A%'),ObjectsWithALessThan100 as( select * from ObjectsWithA where object_id <...

View Article

Answer by DaveShaw for HttpClient ReadAsByteArrayAsync vs ReadAsStreamAsync

Looking at the source the ByteArray method will read the entire stream into a new byte[] copy for you.// The returned array is exposed out of the library, so use ToArray rather// than TryGetBuffer in...

View Article


Answer by DaveShaw for F# async lambda interop with C# async model

Without knowing too much about the Pulimu API's I'd guess that Apply is expecting a Task<T>.You can convert from F# async to Task using Async.StartAsTask like so:let registryInfo =...

View Article

Answer by DaveShaw for Deserialise JSON to Dictionary

A pure .NET Core example if you are only after something simple:let json = """{"some_ key" : "some_value"}"""let data = System.Text.Json.JsonDocument.Parse(json) .RootElement .EnumerateObject() |>...

View Article


Answer by DaveShaw for Need Converting Help C# to F#

Something like this should do the trick:let getEnumDescription value = let fi = value.GetType().GetField(value.ToString()) let attributes = fi.GetCustomAttributes(typedefof<DescriptionAttribute>,...

View Article

Answer by DaveShaw for Generic function to check if value exists within DbSet

Func<T, bool> - Sounds like the right approach to what you want.bool IsFieldValueUnique<T>(Func<T, bool> checkFunction){ var alreadyExists = DbSet<T>.Any(checkFunction); return...

View Article


Answer by DaveShaw for Is it possible to remove the full-paths from .NET...

C# compiler (csc) has a compiler switch -deterministicF# compiler (fsc) appears to have a switch --deterministic+From looking at the DotNet SDK repo it appears there are 2 properties for project...

View Article

Why does assigning a Task then awaiting it allow to run in parallel [duplicate]

I've was playing around with async and I've happened across some behaviour I've not noticed before, if this is a duplicate please let me know, but my google-fu has failed me, mostly because I can't...

View Article

Answer by DaveShaw for Foreach cannot operate on a 'method group' while...

I think .Values is a method, not a property.You should add parenthesis to invoke it.foreach (var val in parsedthothTest.Values()){}

View Article
Browsing index pages (45 articles)


Latest Images