Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get List Of SQL Foreign Keys Using C# Pin
Kevin Marois24-Jul-20 7:53
professionalKevin Marois24-Jul-20 7:53 
GeneralRe: Get List Of SQL Foreign Keys Using C# Pin
Kevin Marois24-Jul-20 7:53
professionalKevin Marois24-Jul-20 7:53 
GeneralRe: Get List Of SQL Foreign Keys Using C# Pin
OriginalGriff24-Jul-20 7:50
mveOriginalGriff24-Jul-20 7:50 
GeneralRe: Get List Of SQL Foreign Keys Using C# Pin
Kevin Marois24-Jul-20 7:53
professionalKevin Marois24-Jul-20 7:53 
QuestionWhat's the most easy-to-read way of initializing a string-int-pair array? Pin
arnold_w23-Jul-20 21:56
arnold_w23-Jul-20 21:56 
AnswerRe: What's the most easy-to-read way of initializing a string-int-pair array? Pin
OriginalGriff23-Jul-20 22:18
mveOriginalGriff23-Jul-20 22:18 
AnswerRe: What's the most easy-to-read way of initializing a string-int-pair array? Pin
Richard MacCutchan23-Jul-20 22:22
mveRichard MacCutchan23-Jul-20 22:22 
AnswerRe: What's the most easy-to-read way of initializing a string-int-pair array? Pin
Richard Deeming23-Jul-20 22:39
mveRichard Deeming23-Jul-20 22:39 
Tricky with an array, but for a List<T> you can use an extension method:
C#
public static class StringAndIntExtensions
{
    public static void Add(this ICollection<StringAndInt> list, string myString, int myInt)
    {
        list.Add(new StringAndInt(myString, myInt));
    }
}
to let you write:
C#
var myList = new List<StringAndInt>
{
    { "String", 0 }, 
    { "String", 1 }, 
    { "String", 2 }
};
The Magical Methods in C# · Cezary Piątek Blog[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: What's the most easy-to-read way of initializing a string-int-pair array? Pin
jsc4224-Jul-20 3:17
professionaljsc4224-Jul-20 3:17 
AnswerRe: What's the most easy-to-read way of initializing a string-int-pair array? Pin
Gerry Schmitz25-Jul-20 7:30
mveGerry Schmitz25-Jul-20 7:30 
AnswerRe: What's the most easy-to-read way of initializing a string-int-pair array? Pin
BillWoodruff27-Jul-20 17:25
professionalBillWoodruff27-Jul-20 17:25 
QuestionHow to convert C++ 2005 project to 2016 Pin
Sheryl Brock23-Jul-20 4:14
Sheryl Brock23-Jul-20 4:14 
AnswerRe: How to convert C++ 2005 project to 2016 Pin
OriginalGriff23-Jul-20 4:18
mveOriginalGriff23-Jul-20 4:18 
SuggestionRe: How to convert C++ 2005 project to 2016 Pin
Richard Deeming23-Jul-20 6:49
mveRichard Deeming23-Jul-20 6:49 
Questionclass to open its database Pin
ago248621-Jul-20 0:17
ago248621-Jul-20 0:17 
GeneralRe: class to open its database Pin
Richard MacCutchan21-Jul-20 0:46
mveRichard MacCutchan21-Jul-20 0:46 
GeneralRe: class to open its database Pin
ago248621-Jul-20 0:55
ago248621-Jul-20 0:55 
GeneralRe: class to open its database Pin
Richard MacCutchan21-Jul-20 1:13
mveRichard MacCutchan21-Jul-20 1:13 
GeneralRe: class to open its database Pin
ago248621-Jul-20 1:22
ago248621-Jul-20 1:22 
GeneralRe: class to open its database Pin
ago248621-Jul-20 1:32
ago248621-Jul-20 1:32 
AnswerRe: class to open its database Pin
OriginalGriff21-Jul-20 1:19
mveOriginalGriff21-Jul-20 1:19 
GeneralRe: class to open its database Pin
ago248621-Jul-20 1:40
ago248621-Jul-20 1:40 
GeneralRe: class to open its database Pin
ago248621-Jul-20 5:59
ago248621-Jul-20 5:59 
QuestionCreating my own enhanced dos language Pin
Member 1270775219-Jul-20 5:30
Member 1270775219-Jul-20 5:30 
AnswerRe: Creating my own enhanced dos language Pin
Dave Kreskowiak19-Jul-20 6:09
mveDave Kreskowiak19-Jul-20 6:09 

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.