Tag Info

Hot answers tagged

11

MyGenericClass`1.cs MyGenericClass`2.cs MyGenericClass`3.cs And so on, where the number after the backtick is the number of generic type parameters. This convention is used by Microsoft. Alternatively, you can use something like MyGenericCollectionClass[TKey, TValue].cs which preserves not only the number of generic type parameters, but also their ...


6

When using .NET (particularly recent versions of .NET), a good guideline is to always use the built-in .NET functionality until and unless there is a marked benefit to doing otherwise. In other words: assume .NET is the right way to get the job done until you strongly suspect (or know) that it isn't. Nine times out of ten, the Framework (having been used so ...


5

If you expect certain exceptions to be handled at the top level of the program (or close to it), create a specific exception class for them so you can identify them. That way you don't accidentally catch exceptions that arise from program bugs or unrecoverable errors (e.g. out of memory). I don't know the purpose of ApplicationException but Microsoft's ...


4

In the case of Tuple and Action that Pete has mentioned, Microsoft themselves use a single file - see Tuple.cs and Action.cs. I think it partly depends on whether or not the functionality for all the classes is basically the same. Personally I dislike lumping classes into a single file, but this might be an exception. In the source code where I work I added ...


4

It depends on the layering of the design. If "nodes" are all in the same layer conceptually, then I would prefer references over events, especially read-only references. References are simpler and easier to trace with static analysis tools: References can be read-only fields, whereas event fields are always mutable. A reference field refers to a single ...


4

Using Win API, you can support long paths in your application: [PathTooLongException]: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. For more information about using long paths in .NET applications, see this blog series: ...


4

A .NET DLL contains Intermediate Language which requires the .NET runtime to execute it and probably some .NET base libraries that it uses/depends on. This means that the DLL can only be used on hardware/operating systems that have a matching .NET Framework available. Writing code for all possible platforms is nearly impossible and I would advise you to ...


3

So, I'm not sure if what I'm about to tell you is still correct but according to Mark Seeman in his book "Dependency Injection in .NET" he states that: Although the correct usage pattern concerning ADO.NET connections should be common knowledge, it's far less known that the same is true for WCF Clients. They should be closed as soon as we're finished ...


2

This is fairly common in ML-style languages like Standard ML/OCaml/F#/Haskell where it's much easier to create the wrapper types. It provides you with two benefits: It allows a piece of code to enforce that a string has undergone validation, without having to take care of that validation itself. It allows you to localize the validation code in one place. ...


2

When you are working with multiple teams on multiple projects, you always had and will have most (if not all) of your troubles relating to interfacing between these projects. You can call it project/library/microservice/etc. - it's always the same as you describe. One team makes breaking changes, the other team(s) suffer. As this problem is quite ...


1

Creating a separate class per service method is a bit of overkill, but it absolutely makes sense to have different classes for unrelated methods. So you can have the UserService class to add, update, delete, reset password, or whatever and a FooService to handle all the stuff related to Foo. Ideally you should have a separate class library project where all ...


1

If your only goal is to reduce maintenance efforts, I suggest instead of making such a major architectural change to your service, add some tools which allow you to manage the four instances "as one". For example: starting and stopping of all four instances at once: can be accomplished by start and stop scripts backing up any data written by your services: ...


1

The biggest change is that the web front end (the part that runs in the browser) has gotten more sophisticated. There are many frameworks that provide enriched functionality at the client; Angular is just one of them. You can look here to find out more about what frameworks are available and what functionality they provide. There is the notion of a Single ...


1

This is a tricky question :) If I really have to choose from only this two options, I would choose A for the simpler form of your task and B for the extended. That is because events does not really make sense until you are calling exactly one function. The primary responsibility of your nodes is to filter the data that they receive. Still when you change ...


1

In order for unit tests to work you have to be able to mock all the external dependencies to your code (otherwise you're doing an integration test). Your problem is you have direct dependencies to your data access implementations. This is coupled with the problem that your handler is both doing it's handling work and is responsible for creating your data ...


1

Use a layered architecture. Place each project in a layer, where each project is dependent only on lower layer projects, so no lower layer project depends on a higher layer project. Without layers, the dependencies become unmanageable as the number of projects multiplies. Once your architecture is layers, you test the lowest layers first, then the layer ...


1

what do you see as being the advantages and disadvantages of using this pattern, and why? Good: It is self contained. Too many validation bits have tendrils reaching into different places. It helps self-documentation. Seeing a method take a ValidatedString makes it much clearer about the semantics of the call. It helps limit validation to one spot ...


1

A DLL is a format used for shared libraries by the Microsoft Windows operating system. Other operating systems use other formats, and since DLLs are binary they cannot generally be used on other processor architectures such as ARM devices. Therefore, DLLs are of no or little use under Mac OS X, on Linux-based operating systems such as Ubuntu, and on mobile ...


1

There is not such thing as only enterprise web application. In the enterprise world you typically have a full enterprise system, where the web part is pretty small compared to the whole system. There are many systems underneath the web that perform batch processing, queue messaging, enterprise integration, gateways and many more. Event at the top there might ...



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