Click here to Skip to main content
15,881,172 members
Home / Discussions / C#
   

C#

 
GeneralRe: Card shuffle program code help needed Pin
OriginalGriff7-Jun-20 20:38
mveOriginalGriff7-Jun-20 20:38 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion8-Jun-20 19:12
Brian_TheLion8-Jun-20 19:12 
GeneralRe: Card shuffle program code help needed Pin
F-ES Sitecore9-Jun-20 2:31
professionalF-ES Sitecore9-Jun-20 2:31 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion9-Jun-20 19:56
Brian_TheLion9-Jun-20 19:56 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion11-Jun-20 18:17
Brian_TheLion11-Jun-20 18:17 
QuestionBest way to store methods in a database? Pin
arnold_w5-Jun-20 22:42
arnold_w5-Jun-20 22:42 
QuestionRe: Best way to store methods in a database? Pin
Richard MacCutchan5-Jun-20 22:58
mveRichard MacCutchan5-Jun-20 22:58 
AnswerRe: Best way to store methods in a database? Pin
arnold_w5-Jun-20 23:56
arnold_w5-Jun-20 23:56 
It's for register maps and register value loop-up for different products and it would be nice if only the database (not the .exe-file) needs to be updated as we add new products and registers. For example, let's assume a register called MONTH, this register would need this table to convert from an integer to a user-friendly string:
1 January
2 February
3 March
4 April
5 May
6 June
7 July
8 August
9 September
10 October
11 November
12 December

Now, let's a assume a different register called YEAR_MONTH_AND_DATE, all stored within the same integer, image how big that lookup table would be. Instead, it would be much easier to just a have method to do the conversion:
C#
public string convertYearMonthAndDate(UInt32 yearMonthAndDate)
{
    UInt16 year = (UInt16)(yearMonthAndDate >> 16);
    byte month  = (byte)  (yearMonthAndDate >> 8);
    byte date   = (byte)  (yearMonthAndDate >> 0);
    string monthString = "";
    switch (month)
    {
        case  1:  monthString = "January";   break;
        case  2:  monthString = "February";  break;
        case  3:  monthString = "March";     break;
        case  4:  monthString = "April";     break;
        case  5:  monthString = "May";       break;
        case  6:  monthString = "June";      break;
        case  7:  monthString = "July";      break;
        case  8:  monthString = "August";    break;
        case  9:  monthString = "September"; break;
        case 10:  monthString = "October";   break;
        case 11:  monthString = "November";  break;
        case 12:  monthString = "December";  break;
    }
    return monthString + " " + date + ", " + year;
}

GeneralRe: Best way to store methods in a database? Pin
Richard MacCutchan6-Jun-20 0:10
mveRichard MacCutchan6-Jun-20 0:10 
GeneralRe: Best way to store methods in a database? Pin
arnold_w6-Jun-20 0:14
arnold_w6-Jun-20 0:14 
AnswerRe: Best way to store methods in a database? Pin
kalberts6-Jun-20 5:22
kalberts6-Jun-20 5:22 
GeneralRe: Best way to store methods in a database? Pin
Richard MacCutchan6-Jun-20 5:26
mveRichard MacCutchan6-Jun-20 5:26 
AnswerRe: Best way to store methods in a database? Pin
Eddy Vluggen5-Jun-20 23:48
professionalEddy Vluggen5-Jun-20 23:48 
AnswerRe: Best way to store methods in a database? Pin
Richard Deeming8-Jun-20 0:05
mveRichard Deeming8-Jun-20 0:05 
GeneralRe: Best way to store methods in a database? Pin
#realJSOP9-Jun-20 23:25
mve#realJSOP9-Jun-20 23:25 
GeneralRe: Best way to store methods in a database? Pin
kalberts10-Jun-20 10:58
kalberts10-Jun-20 10:58 
QuestionMulti programming language Pin
Member 148535394-Jun-20 6:13
Member 148535394-Jun-20 6:13 
AnswerRe: Multi programming language Pin
Richard MacCutchan4-Jun-20 6:15
mveRichard MacCutchan4-Jun-20 6:15 
AnswerRe: Multi programming language Pin
OriginalGriff4-Jun-20 6:35
mveOriginalGriff4-Jun-20 6:35 
AnswerRe: Multi programming language Pin
Pete O'Hanlon4-Jun-20 21:43
mvePete O'Hanlon4-Jun-20 21:43 
GeneralRe: Multi programming language Pin
OriginalGriff4-Jun-20 21:50
mveOriginalGriff4-Jun-20 21:50 
GeneralRe: Multi programming language Pin
Pete O'Hanlon4-Jun-20 22:02
mvePete O'Hanlon4-Jun-20 22:02 
AnswerRe: Multi programming language Pin
Patrice T5-Jun-20 13:33
mvePatrice T5-Jun-20 13:33 
QuestionMulti programming language Pin
Member 148535394-Jun-20 5:38
Member 148535394-Jun-20 5:38 
AnswerRe: Multi programming language Pin
Richard Deeming4-Jun-20 5:45
mveRichard Deeming4-Jun-20 5:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.