Click here to Skip to main content
15,888,579 members
Home / Discussions / C#
   

C#

 
QuestionNeed help calling a static method Pin
Member 148563427-Jun-20 15:00
Member 148563427-Jun-20 15:00 
AnswerRe: Need help calling a static method Pin
OriginalGriff7-Jun-20 20:29
mveOriginalGriff7-Jun-20 20:29 
QuestionCard shuffle program code help needed Pin
Brian_TheLion7-Jun-20 3:57
Brian_TheLion7-Jun-20 3:57 
AnswerRe: Card shuffle program code help needed Pin
Dave Kreskowiak7-Jun-20 4:03
mveDave Kreskowiak7-Jun-20 4:03 
GeneralRe: Card shuffle program code help needed Pin
OriginalGriff7-Jun-20 4:14
mveOriginalGriff7-Jun-20 4:14 
GeneralRe: Card shuffle program code help needed Pin
Dave Kreskowiak7-Jun-20 8:05
mveDave Kreskowiak7-Jun-20 8:05 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion8-Jun-20 19:17
Brian_TheLion8-Jun-20 19:17 
GeneralRe: Card shuffle program code help needed (code included) Pin
Brian_TheLion7-Jun-20 15:27
Brian_TheLion7-Jun-20 15:27 
GeneralRe: Card shuffle program code help needed (code included) Pin
Richard MacCutchan7-Jun-20 21:51
mveRichard MacCutchan7-Jun-20 21:51 
GeneralRe: Card shuffle program code help needed (code included) Pin
Brian_TheLion8-Jun-20 19:15
Brian_TheLion8-Jun-20 19:15 
GeneralRe: Card shuffle program code help needed (code included) Pin
Richard MacCutchan8-Jun-20 21:30
mveRichard MacCutchan8-Jun-20 21:30 
GeneralRe: Card shuffle program code help needed (code included) Pin
Richard Deeming8-Jun-20 0:08
mveRichard Deeming8-Jun-20 0:08 
GeneralRe: Card shuffle program code help needed (code included) Pin
Brian_TheLion8-Jun-20 19:01
Brian_TheLion8-Jun-20 19:01 
GeneralRe: Card shuffle program code help needed (code included) Pin
Richard Deeming8-Jun-20 22:16
mveRichard Deeming8-Jun-20 22:16 
GeneralRe: Card shuffle program code help needed (code included) Pin
Brian_TheLion11-Jun-20 18:20
Brian_TheLion11-Jun-20 18:20 
AnswerRe: Card shuffle program code help needed Pin
OriginalGriff7-Jun-20 4:11
mveOriginalGriff7-Jun-20 4:11 
GeneralRe: Card shuffle program code help needed Pin
Brian_TheLion7-Jun-20 15:37
Brian_TheLion7-Jun-20 15:37 
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;
}

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.