Tagged Questions
14
votes
2answers
427 views
Simple temperature converter
Below is my first attempt at programming a Celsius to Fahrenheit converter in C# winforms. I'm looking for tips and advice on improving my style and what I can do to make the code more ...
11
votes
7answers
533 views
Class for handling unit conversions
I am creating a class to be the end all defacto class for handling unit conversions. This is particularly difficult in my company's industry where imperial architectural strings are used as units. I ...
11
votes
2answers
9k views
Integer to Alphabet string (“A”, “B”, …“Z”, “AA”, “AB”…)
So this question is prompted by two things.
I found some code in our source control doing this sort of things.
These SO questions:
...
10
votes
4answers
333 views
Type system for different representations of angle value
I want to implement a Type system for different representations of an angle value. Motivation to implement this as a type system comes from this question.
Angle can be represented using the ...
7
votes
5answers
10k views
7
votes
1answer
5k views
Converting binary value from BitArray to an int and back in C#
What I am creating is essentially a binary clock face with touch input for setting values as well as displaying - so I need to convert both ways between an int and a binary sequence in a BitArray.
I ...
5
votes
3answers
288 views
Displaying TimeSpan as largest interval (with units)
The following method is used in a call center application to display an approximation of remaining time. The call center telephone operator would inform the caller that they could perform their ...
5
votes
2answers
247 views
Hex file converter
I have written a C# file reader that reads a file converts the bytes of the file to hex and writes it out to another file. It works fine but it takes 7.2GB of memory when converting a 300MB file.
...
5
votes
1answer
5k views
Converting List to a DataTable and/or DataSet Extension Methods
Can someone help me improve this code? I and trying to have a couple extension methods to convert strongly-typed lists to a DataSet and ...
5
votes
3answers
1k views
Converting a range of integers from a string to an IEnumerable
Goal
Convert the following into an IEnumerable of integers accounting for the x-y ranges:
...
5
votes
2answers
60 views
Convert string to multiline text
I made this method that takes any string and transforms it into a multiline text l; each line having the max (character) length specified by the rowLength ...
5
votes
1answer
78 views
Generic Converter framework
I find myself frequently converting between formats so I have come up with the following conversion framework:
The converter interface surfaces a method to convert from a source type to a target ...
4
votes
1answer
68 views
Convert hex string to byte array
The goal is to convert a hex string to a byte array with the following requirements:
\$O(1)\$ additional space apart from input and output.
\$O(n)\$ runtime
This mostly just prohibits creating a ...
4
votes
1answer
84 views
Program for importing autotask contracts into dynamics CRM 2011
We regularly have to convert a bunch of autotask Contracts to a custom CRM entity because we have employees who don't work in Autotask but need those contracts. I wrote the above code to handle this ...
3
votes
3answers
1k views
3
votes
1answer
61 views
Displaying TimeSpan as largest interval (with units) - Part II
[This is a follow-up question to: Displaying TimeSpan as largest interval (with units). The code listed here has been refactored since the original question was posed. Please note that the scope of ...
3
votes
1answer
16k views
Faster way to convert DataTable to List of Class
I am using ExcelDataReader to import an excel file to a dataset. Example Excel table below:
...
2
votes
3answers
1k views
Convert Sql LIKE to Regex
I have a bit of code that converts a Sql Like expression to a regex expression for the purposes of a Linq to objects Like extension method. For some time I have ...
2
votes
1answer
81 views
Web service - getting data from SQL and adding to Object
I have created a class called CommandMessages
...
1
vote
1answer
207 views
Help me improve my attempt to slap strong types on top of COM and ODBC
I am stuck with some old API that involves COM and ODBC, and I cannot switch to cool things like MEF or entity framework. So, I am working on some wrappers that will help me write less code and also ...
0
votes
3answers
736 views
Converting a c# enum into a list to be sent to the client
I want to use the enum on the client for a dropdown list. Does this make sense, or is there a smarter way of doing this?
...