Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

4

The short answer is because a is a pattern variable and pattern variables are scoped to their containing block. For example, if you proceed that switch with if (p is Dog a) return; then it'll no longer compile as it will complain that your two a variables are already defined. That's because the "containing block" for an if is the block that contains the if. ...


3

There are various problems with your code, eg the tight coupling to SqlConnection, and the fragile base class problem that you risk saddling yourself with by coupling Process to the child class methods DeleteStep1Data and Transform. The problem with tightly coupling things to SqlConnection is that you make the code far harder to test: there has to be a ...


3

Just create new objects when you have a new call. It's pointless to spend hours debugging and tweaking code to slightly more efficiently use 5 cents worth of memory.


2

A broader take on the question. Comparison between two approaches to value conversion: Discrete value converter objects, which are declared in XAML. The data types of the ViewModel's properties don't need to match the data types of the corresponding controls in the View. The architectural advantage of this approach is that property exposed by the ...


1

Looking at your code, you only appear to have one "prop" per object type. Therefore, you don't need a Dictionary<string, string>. Just a KeyValuePair<string, string> or even a tuple, (string key, string value) would suffice. Secondly, your switch or if/else approach is far too procedural for this task. It's a declarative problem, so use a ...


Only top voted, non community-wiki answers of a minimum length are eligible