Skip to main content

Questions tagged [.net]

The .NET Framework is a software framework for Microsoft Windows operating systems. It includes an implementation of the Base Class Library, Common Language Runtime, and Dynamic Language Runtime. It supports many programming languages, including C#, VB.NET, F# and C++.

Filter by
Sorted by
Tagged with
96 votes
8 answers
54k views

Return magic value, throw exception or return false on failure?

I sometimes end up having to write a method or property for a class library for which it is not exceptional to have no real answer, but a failure. Something cannot be determined, is not available, not ...
Daniel A.A. Pelsmaeker's user avatar
27 votes
8 answers
7k views

How to Avoid Fragile Unit Tests?

We have written close to 3,000 tests -- data has been hard coded, very little reuse of code. This methodology has began to bite us. As the system changes we find ourselves spending more time fixing ...
Chuck Conway's user avatar
64 votes
17 answers
37k views

Why use an OO approach instead of a giant "switch" statement?

I am working in a .Net, C# shop and I have a coworker that keeps insisting that we should use giant Switch statements in our code with lots of "Cases" rather than more object oriented approaches. His ...
James P. Wright's user avatar
170 votes
10 answers
24k views

Mono is frequently used to say "Yes, .NET is cross-platform". How valid is that claim? [closed]

In What would you choose for your project between .NET and Java at this point in time? I say that I would consider the "Will you always deploy to Windows?" the single most important technical decision ...
user avatar
32 votes
3 answers
30k views

Is it bad practice to use public fields? [duplicate]

Possible Duplicate: When are Getters and Setters Justified Why are public and private accessors considered good practice? In my time as developer I learned that properties can be very useful. I ...
Jonathan Egerton's user avatar
158 votes
8 answers
179k views

How do you organize your projects? [closed]

Do you have any particular style of organizing projects? For example, currently I'm creating a project for a couple of schools here in Bolivia, this is how I organized it: TutoMentor (Solution) ...
user avatar
150 votes
8 answers
24k views

Are bad programming practices typical within the software industry? [closed]

I just started my first job as a software developer over a month ago. Everything I have learned about OOP, SOLID, DRY, YAGNI, design patterns, SRP, etc. can be thrown out the window. They use C# .NET ...
Grim's user avatar
  • 903
22 votes
7 answers
999 views

Does making source code available affect your ability to generate revenue?

We’re working on a .Net framework which ultimately amounts to a single DLL. We intend to charge for commercial use of the framework, but make it free for open source/non-commercial use. The rough ...
dwynne's user avatar
  • 431
19 votes
11 answers
57k views

Recommended .NET / C# coding standards? [closed]

What coding standards do you think are important for .NET / C# projects? This could be anything from dealing with curly braces and spacing and pedantry like that. Or it could be more fundamental ...
RationalGeek's user avatar
  • 10.1k
17 votes
7 answers
1k views

How do you structure your shared code so that it is "re-findable" for new developers? [duplicate]

I started working at my current job about 8 months ago, and its been one of the best experiences I've had as a young programmer. It's a small company, and both my co-developers are brilliant guys. ...
awmckinley's user avatar
16 votes
3 answers
16k views

What is the benefit to having pure POCO models?

What is the major benefit of having pure POCO models? I get that Models should be clean and simple, but I tend to like to keep the maintenance of child objects within the model classes. For example ...
Jesse's user avatar
  • 321
11 votes
3 answers
6k views

Why are CIL and CLR required in .NET?

I saw this nice image here. I learned that all the compilers that support .net language convert the source code to CIL format. Now Microsoft is never bringing in .NET for all the operating system by ...
vikkyhacks's user avatar
82 votes
6 answers
19k views

When to go Fluent in C#?

In many respects I really like the idea of Fluent interfaces, but with all of the modern features of C# (initializers, lambdas, named parameters) I find myself thinking, "is it worth it?", and "Is ...
Andrew Hanlon's user avatar
48 votes
5 answers
36k views

async+await == sync?

Stumbled upon this post that talks about making async web requests. Now simplicity aside, if in real world, all you do is make an async request and wait for it in the very next line, isn't that the ...
Mrchief's user avatar
  • 631
31 votes
4 answers
4k views

Why do we need the async keyword?

I just started playing around with async/await in .Net 4.5. One thing I'm initially curious about, why is the async keyword necessary? The explanation I read was that it is a marker so the compiler ...
ConditionRacer's user avatar
17 votes
7 answers
14k views

Is throwing an exception from a property bad form?

I've always been of the mindset that properties (ie, their set/get operations) should be fast/immediate and failure-free. You should never have to try/catch around getting or setting a property. But ...
Steven Evers's user avatar
  • 28.2k
17 votes
2 answers
19k views

Multiple applications in a single Visual Studio solution [closed]

I am doing work for a company that is wanting to put all their .Net applications (web applications, Windows applications and console applications) together in a single Visual Studio solution. I am ...
BruceHill's user avatar
  • 281
14 votes
4 answers
21k views

Dependency injection for a library with internal dependencies

Background I am working on a class library in support of a web site. The library combines related APIs from several different vendors, all of which have their own particular nuances and domain ...
John Wu's user avatar
  • 26.6k
13 votes
7 answers
2k views

What constitutes proper use of threads in programming?

I am tired of hearing people recommend that you should use only one thread per processor, while many programs use up to 100 per process! take for example some common programs vb.net ide uses about 25 ...
Smith's user avatar
  • 643
7 votes
1 answer
3k views

Knowledge Transfer and software development [duplicate]

I have been working on an application alone for several years. I am now asked to transfer knowledge to a few other developers, which I think is a good idea because it will allow us to share the ...
w0051977's user avatar
  • 7,119
2 votes
1 answer
6k views

How to handle exception in REST API

Given a REST API, which throws an exception when handling a request from a client. Whenever the REST API throws an exception, it's logged and the application (in this case a console application) ...
ebb's user avatar
  • 123
159 votes
6 answers
38k views

SOLID Principles and code structure

At a recent job interview, I couldn't answer a question about SOLID -- beyond providing the basic meaning of the various principles. It really bugs me. I have done a couple of days worth of digging ...
S-Unit's user avatar
  • 1,397
149 votes
7 answers
300k views

Relationship between C#, .NET, ASP, ASP.NET etc [closed]

I'm really unclear on the difference between C#, C#.NET and the same for ASP and other '.NET' languages. From what I understand, .NET is a library/framework of... things. I think they're essentially ...
Megan Walker's user avatar
  • 2,026
59 votes
7 answers
203k views

.NET Properties - Use Private Set or ReadOnly Property?

In what situation should I use a Private Set on a property versus making it a ReadOnly property? Take into consideration the two very simplistic examples below. First example: Public Class Person ...
tgxiii's user avatar
  • 693
46 votes
5 answers
18k views

As a C# developer, would you learn Java to develop for Android or use MonoDroid instead? [closed]

I'd consider myself pretty well versed in C#. It's my language of choice at the moment, and it's where basically all my professional experience lies. Still, I'm puzzled by the existence of the ...
Dan Tao's user avatar
  • 1,201
34 votes
6 answers
45k views

Why would you ever 'await' a method, and then immediately interrogate its return value?

In this MSDN article, the following example code is provided (slightly edited for brevity): public async Task<ActionResult> Details(int? id) { if (id == null) { return new ...
Robert Harvey's user avatar
26 votes
5 answers
8k views

MonoTouch vs Objective-C for iPhone/iPod/iPad development [closed]

For someone with .Net experience and wanting to develop for iPhone/iPod/iPad, is it worth learning Objective-C? Is MonoTouch a good alternative? What are some of the trade-offs when using MonoTouch vs ...
ysolik's user avatar
  • 6,330
25 votes
5 answers
8k views

Is my usage of explicit casting operator reasonable or a bad hack?

I have a big object: class BigObject{ public int Id {get;set;} public string FieldA {get;set;} // ... public string FieldZ {get;set;} } and a specialized, DTO-like object: class ...
Gerino's user avatar
  • 471
17 votes
11 answers
5k views

Why all classes in .NET globally inherits from Object class?

Its very interesting for me which advantages gives "global root class" approach for framework. In simple words what reasons resulted the .NET framework was designed to have one root object class with ...
Anton Semenov's user avatar
17 votes
10 answers
2k views

How do you normally layout a class's regions?

I was wondering if there was a standard for laying out a class's regions. I currently use Fields Constructor Properties Public Methods Private Methods Fields being Private Properties and ...
Rachel's user avatar
  • 24k
17 votes
20 answers
19k views

VB.Net vs C# debate [closed]

I've been in workplaces where, at the start of a project, the "Should we use VB.Net or C#" question has been raised. Granted, it's probably less common to have to make that decision now than it was ...
15 votes
7 answers
6k views

Use of NotImplementedException

Is it considered bad practice to throw NotImplementedException for code you haven't written yet? Possibly TODO comments would be considered safer?
Tom Squires's user avatar
  • 17.8k
14 votes
9 answers
21k views

Are too many if-else statements for validation bad? [duplicate]

From the book Professional Enterprise .Net, which has 5 star rating on Amazon that I am doubting after having a read through. Here is a Borrower class (In C# but it's pretty basic; anyone can ...
iAteABug_And_iLiked_it's user avatar
13 votes
6 answers
10k views

What would you choose for your project between .NET and Java at this point in time? [closed]

You are just starting a new project and you have these two technologies to choose from, Java and .NET. The project you are working doesn't involve having features that would make it easy to choose ...
user avatar
11 votes
3 answers
2k views

What's the reasoning behind the "I" prefix naming convention for interfaces in .NET?

I know the "I" convention has been around since COM, but I've never understood why it hasn't been reconsidered like every other naming convention before .NET has. Consumption wise, the only thing ...
Rei Miyasaka's user avatar
  • 4,551
8 votes
6 answers
2k views

Would you re-design completely under .Net?

A very extensive application began as an Access-based system (for database storage). Forms were written in VB5 and/or VB6. As .Net became a fixture in the development community, certain modules have ...
IAbstract's user avatar
  • 1,556
8 votes
3 answers
2k views

.NET Dependency Management Systems

I have some .NET projects that are starting to get large enough to merit looking into Dependency Management solutions, so we don't have to copy binaries from one project to another. Here's what I've ...
StriplingWarrior's user avatar
7 votes
1 answer
2k views

if I use .NET Framework for my application, do I have to pay anything to Microsoft?

I am planning to develop an enterprise application using .NET Framework. I will sell that application to other companies. Do I have to make any payment to Microsoft, like royalties or something else?
Dhaval Patel's user avatar
7 votes
4 answers
3k views

n-layers architecture design, really worth the effort?

I was building an application in .Net for almost a year (almost alone), I took the decision to build it with a 3-layer design. Recently when finished the project, I analyzed if the effort of creating ...
Rafael's user avatar
  • 687
5 votes
7 answers
2k views

Is using a lot of free third party libraries a good thing? [closed]

For your proprietary projects at work? Problems I can imagine are: more dlls (can be a problem when for example you have to include a big DLL but you only need few functions in that library), a lot ...
Louis Rhys's user avatar
  • 6,142
5 votes
4 answers
9k views

invoking methods within a conditional expression

In an oft-cited (if dated) reference for C# coding standards (pdf; from Lance Hunt), the statement is made, 33. Avoid invoking methods within a conditional expression. I've not seen this ...
kmote's user avatar
  • 3,332
4 votes
7 answers
5k views

What is the objective of unit testing? [duplicate]

Possible Duplicate: Is unit testing or test-driven development worthwhile? I've been working with C# for the last 2 years, and I've never done any unit testing. I just need to know what the ...
Mou's user avatar
  • 209
4 votes
6 answers
3k views

Why isn't the line count in Visual Studio zero-based? [closed]

This just struck me as an oversight by Microsoft. Since arrays and other data-structures within the .NET framework begin from zero (zero-based) why don't we have a line 0 within the code view in ...
billy.bob's user avatar
  • 6,539
3 votes
6 answers
3k views

How to include database changes during application publish

I am maintaining a WinForms application, which talks to a SQL Server database. Sometimes I have to change database schema (for example to alter a sql procedure or add new one). For this purpose I have ...
sventevit's user avatar
  • 212
2 votes
1 answer
3k views

Which Software Layer should hold Pagination Information?

Which layer should hold pagination information? (Page Size, Page Number), Eg say 100 products, 5 product per 20 pages. User can type in API url layer. api/Product?Page=1&Limit=2&ColumnSort=...
Matt Smith's user avatar
-1 votes
1 answer
764 views

Designing XML - confused between attributes and elements [closed]

I have to design an xml structure to set standard data exchange with my client. We deal with payments and its related data. At now, my XML data looks like this: <PAYMENTS> <CURRENCY>...
now he who must not be named.'s user avatar
124 votes
12 answers
21k views

Effective Strategies for Localization in .NET [closed]

I am developing the UI for a .NET MVC application that will require international localization of all content in the near future. I am very familiar with .NET in general but have never had a project ...
smartcaveman's user avatar
  • 1,522
64 votes
13 answers
8k views

My boss has a bad case of "Not Invented Here" [closed]

My department specializes in converting customer data into our database schema so that they can use our software. Right now, we have C# applications that take an IDataReader (99% of the time it is a ...
Scott Chamberlain's user avatar
55 votes
2 answers
22k views

Why is 'void' not allowed as a generic type in C#

What were the design decisions that argued in favour of void not being constructable and not being allowed as a generic type? After all it is just a special empty struct and would have avoided the ...
user avatar
52 votes
11 answers
5k views

I don't understand how TDD helps me get a good design if I need a design to start testing it

I'm trying to wrap my head around TDD, specifically the development part. I've looked at some books, but the ones I found mainly tackle the testing part - the History of NUnit, why testing is good, ...
Michael Stum's user avatar
  • 1,778