Questions tagged [.net]

.NET is a software framework supporting a multi-language paradigm and supporting language interoperability. .NET applications are executed in a virtual machine (CLR) which provides a few important services: security, memory management and exception handling.

Filter by
Sorted by
Tagged with
2
votes
1answer
182 views

Building a very basic calculator

I have been a VB developer for couple of years, but strictly using functional programming paradigms — I just started using object-oriented paradigms a few days ago, and want some advice on how ...
3
votes
1answer
152 views

Exposing .NET's internal StorageRoot via Reflection for accessing file/stream-based Structured Storage

.NET tantalizingly exposes StorageInfo and StreamInfo as public classes, but hides the ...
5
votes
1answer
5k views

Encrypt and decrypt a message using AES-256 with GCM mode using Bouncy Castle C# library

Goal: Given a plaintext message and 256 bit key, encrypt (and subsequently decrypt) the message using a 12 byte IV (in this case null bytes for simplicity, should not do this, I know) with MAC of ...
4
votes
1answer
131 views

Binary search for a missing or default value by a given formula

An application I've been working on for a while needs a manner to find a missing element from a sorted array, the problem with the application is that these values aren't numeric. They have a formula, ...
0
votes
1answer
815 views

Email Sending Application

So this is an automatic email sending application, it reads with Handlebar the email templates and assembles them, and then sends the email classes. My goal with the code is to make it as easy to ...
4
votes
3answers
267 views

Determining the region from several sources of information

The task is to determine the region by comparing three sources of information taking into account the coefficients of their importance. ...
0
votes
1answer
70 views

Simple property formatting

In a VB.Net class, I have an method that replaces all square brackets [] in certain properties by normal brackets (). Edit: The ...
2
votes
0answers
71 views

REST API design to handle status migrations

I have a requirement to provide an API which would allow to change status of Order. The API is supposed to follow REST principles, so I have designed an endpoint ...
2
votes
2answers
107 views

Two maximal value in array. Sorted and Array.Sort()

Compare the two methods of sorting the array in ascending order, where can I optimize? How best to handle exception handling? ...
2
votes
2answers
80 views

How to avoid code duplication in ordering system

Here is the piece of order system. And this is hierarchy of order classes in this system ...
-1
votes
1answer
2k views

If and else without curly brackets [closed]

Is it possible to have an if condition with curly brackets and else conditions without brackets? Also what is the good practice to format it , should there be a new line after else keyword? ...
6
votes
2answers
420 views

Automatic Email Script/Program for fictional e-store C#

This is a fictional email sending program for a e-store I've done for practice purposes. EmailSenderProgram is a program sending emails to customers. Currently it sends two types of email: "welcome" ...
2
votes
1answer
85 views

Marshaling to a complex structure in .net

This is a follow up from question https://stackoverflow.com/questions/45106245/net-file-random-access-recoard-locking I have been able to make the reading and marshalling work ok but the performance ...
2
votes
1answer
927 views

Project Euler 19 (count Sundays in the 20th Century) with a while loop

I'm working on Project Euler problem 19, which reads as follows: You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. ...
2
votes
0answers
48 views

Updating Excel sheet with information from a DataTable

Basically, I'm trying to update an excel sheet using a DataTable (The columns structure between the two are not the same) with respect to the following rules: ...
6
votes
1answer
1k views

Railway Oriented Programming (ROP) in C#

I am not sure if there are good ROP implementations already existing in the open because I couldn't find any, actually I found one by odytrice (https://github.com/odytrice/Operation), but I think the ...
2
votes
2answers
115 views

Comparison of 2 values based on custom operator

I am working on a library that parses query strings and evaluates the result for a given context. The query has the format FIELD OPERATOR VALUE (AND|OR) .... The ...
2
votes
1answer
91 views

Mailsending application for e-store

This is a fictional email sending program for a e-store I've done for practice purposes. EmailSenderProgram is a program sending emails to customers. Currently it sends two types of email: "welcome" ...
1
vote
1answer
136 views

Brute-force-like solution to Project Euler Problem 5

Project Euler problem #5 is the following: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that ...
3
votes
1answer
498 views

E-store automatic email send, to be run daily

This is a fictional email sending program for a e-store I've done for practice purposes. EmailSenderProgram is a program sending emails to customers. Currently it ...
0
votes
2answers
122 views

User and group management access to main class

UserGroup is not the main class. I don't really mind putting these classes in a class as they are related. I would still like to break them out. Problem I have is if I put ...
1
vote
2answers
291 views

Manage Users and Groups

This is part of a document management application that is in a prior question. Manage users, roles, and groups. A user can have only one role but they can be in many groups. There is join struct ...
-2
votes
1answer
161 views

Document Management Properties and Searching

This is the 'middle-ware' for a document management application. A document has properties which describe it, and allow users to search for it. The server will interact with the database, and the User-...
5
votes
0answers
177 views

WebPage LogReader class - Parallel DNS w/timeout for computer IP's and domains from log scrape

This is a namespace to read a bunch of events from a log file and display them in a table on a webpage, some additional data (computer domain and IP address) is also pulled in from DNS. I am mostly ...
12
votes
3answers
9k views

Function to find a certificate in either the user or the machine store

I wanted a function that would return a certificate, given its serial number, regardless of which store it is in. It has to do almost the same exact thing but twice (once for each store). To keep it ...
9
votes
3answers
549 views

LINQ-ifying Colour Generation from Strings

Recently I was thinking about how Google, Microsoft Outlook on Windows Phone (and now many others) method of giving you a coloured icon with a letter in the centre of it works. Essentially, given ...
2
votes
1answer
790 views

Converting a JSON object to XML to be passed to an ASMX webservice

What I have is a scenario where we need to be able to call any ASMX web service and pass any data structure to it that has been constructed on the JavaScript side. Until now, I have been creating ...
4
votes
2answers
423 views

Count sort implementation

Is this a proper Count sort implementation? Code and style improvements? It does not support negative and that should be improved. A large input could cause out of memory. Some of the array index ...
0
votes
1answer
164 views

Validate Czech Birth number [closed]

I will not go into depth as for how Czech Birth number should exactly look like. It is kind of similar to insuarance number, example: Let's say a valid Birth number may be e.g.: ...
1
vote
2answers
523 views

Selection Sort Implementation

Is this a proper selection sort? Any code issues? ...
0
votes
1answer
95 views

PCR analysis on data imported from Excel

I'm writing a program that is going to analyse some data imported from an Excel spreadsheet. It is currently running quite slow (couple seconds on an average machine) and I was wondering whether it ...
4
votes
1answer
3k views

Generic repository and generic service

I use the Repository/Service design pattern in my projects. I have doubts whether it is worth using common services BaseEntity: ...
5
votes
3answers
416 views

Determine objects to delete from a database

I have the following method which determines which cars I need to delete from the DB. ...
4
votes
2answers
2k views

Make change for a given amount given denominations

Make change like at a cash register Input is the denominations of the currency and the sum In test case only coins are entered Return how many of each denomination Return the fewest possible ...
5
votes
1answer
453 views

Splitting a UTF-8 string into equal-sized byte-arrays for parallel processing

Based upon a question from Stack Overflow, I wanted to expand on the answer I wrote and define a solution that would support ordering the strings (after processing). So this starts off with a basic <...
1
vote
3answers
1k views

Two circles intersect

Do two circles in a 2D plane disjoint? $$(r_1 + r_2) \cdot (r_1 + r_2) \gt \Delta{X} \cdot \Delta{X} + \Delta{Y} \cdot \Delta{Y}$$ Any comments / corrections on this code? ...
4
votes
1answer
235 views

Component-based system for animals

I'm making a small Zoo application, in this question I will cover only the basics - the animals. I've picked the component-based design over inheritance because the creatures can be quite complex ...
-2
votes
1answer
271 views

Improvements for this Rounding Method [closed]

This is used to round to any desired quarter, half etc. Is there any improvements that can be made for performance, unforeseen roundoff issues etc...? ...
2
votes
2answers
366 views

Console single player blackjack versus a dealer again

This is the second pass on this. pass one A single player versus a dealer. It does not perform bets - it only track wins and losses and has no splitting. Other than that I tried to get it all in. I ...
2
votes
1answer
644 views

Tree containing different data types [closed]

For a while I was thinking of a way I could have multiple objects of different types that related to each other be included in a tree. For example, say I have CEO, Manager, Representative which all ...
1
vote
1answer
2k views

Single player console Blackjack game

This is just a single player versus a dealer. I'm not worried about execution time. It does not perform bets - it only track wins and losses- and has no splitting. Other than that I tried to get it ...
3
votes
2answers
2k views

Simple dice console game in C#

I wrote a little console game that is supposed to take some dice and some players and determine the winner of the game. I wrote it for the sole purpose of figuring out why i'm doing the things i'm ...
-1
votes
3answers
769 views

Distance too close

Are two points too close? Trying to do the math as efficiently as possible. deltaX + deltaY is going to be > than the actual distance You might use this in game play - are players in range? ...
3
votes
5answers
2k views

Absolute Values and Fractions

$$ \frac{|x|-|y|}{1+|xy|} $$ How can I reduce the amount of code without losing quality? What are your tips? Your comments on the structure, logic, in general, everything. How to make the type of ...
4
votes
2answers
1k views

Classifying a person by name, gender, and age using Chain of Responsibility pattern

I am very new to design pattern. Recently, I learned about the Chain of Responsibility pattern, so I tried to practice it. These nested conditionals are what I'm trying to replace with polymorphism ...
5
votes
3answers
489 views

The Atbash Cipher

I am doing some exercises in C# and I have just finished writing my own implementation of the atbash cipher, here is the code: ...
4
votes
1answer
352 views

Flexible TCP socket framework

I'm working on a flexible socket framework and trying to polish it so it's actually something usable in further development. Would really appreciate any critique, also I’m really interested whether I'...
1
vote
0answers
37 views

Script to append a new method to a XAML code-behind file

My company is converting a VB.NET project to a C# application and I was tasked with writing a script to automate part of the process. In particular, given information about a control name and event in ...
6
votes
4answers
3k views

Splitting a string on delimiter outside of quotes while returning item-by-item

One of the more recent functions I've needed for personal and work purposes is to split a string on a delimiter, but while ignoring the delimiter when inside a quote. Just as well, if within a quote ...
1
vote
0answers
348 views

Sauna experiment

This is my program for a sauna. It is a Swedish sauna meant to only understand Celsius, but the user can only understand Fahrenheit, so when the user inputs Fahrenheit it is converted to celcius. ...