Click here to Skip to main content
14,642,979 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
MemberBrian_TheLion8-Jun-20 19:12 
GeneralRe: Card shuffle program code help needed Pin
F-ES Sitecore9-Jun-20 2:31
mveF-ES Sitecore9-Jun-20 2:31 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion9-Jun-20 19:56
MemberBrian_TheLion9-Jun-20 19:56 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion11-Jun-20 18:17
MemberBrian_TheLion11-Jun-20 18:17 
QuestionBest way to store methods in a database? Pin
arnold_w5-Jun-20 22:42
Memberarnold_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
Memberarnold_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:
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
Memberarnold_w6-Jun-20 0:14 
AnswerRe: Best way to store methods in a database? Pin
Member 79891226-Jun-20 5:22
MemberMember 79891226-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
mva#realJSOP9-Jun-20 23:25 
GeneralRe: Best way to store methods in a database? Pin
Member 798912210-Jun-20 10:58
MemberMember 798912210-Jun-20 10:58 
QuestionMulti programming language Pin
Member 148535394-Jun-20 6:13
MemberMember 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
subeditorPete 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
subeditorPete 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
MemberMember 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.