Click here to Skip to main content
15,893,486 members
Home / Discussions / C#
   

C#

 
Questioncreate a program Pin
Member 105197957-Aug-16 20:45
Member 105197957-Aug-16 20:45 
AnswerRe: create a program Pin
Richard MacCutchan7-Aug-16 21:11
mveRichard MacCutchan7-Aug-16 21:11 
AnswerRe: create a program Pin
Pete O'Hanlon7-Aug-16 21:14
mvePete O'Hanlon7-Aug-16 21:14 
Generalcreate a new data table on every click of a button Pin
Member 126599265-Aug-16 1:21
Member 126599265-Aug-16 1:21 
GeneralRe: create a new data table on every click of a button Pin
dan!sh 5-Aug-16 1:45
professional dan!sh 5-Aug-16 1:45 
GeneralRe: create a new data table on every click of a button Pin
Member 126599265-Aug-16 2:05
Member 126599265-Aug-16 2:05 
GeneralRe: create a new data table on every click of a button Pin
Mycroft Holmes5-Aug-16 2:30
professionalMycroft Holmes5-Aug-16 2:30 
GeneralRe: create a new data table on every click of a button Pin
BillWoodruff5-Aug-16 2:36
professionalBillWoodruff5-Aug-16 2:36 
QuestionHow add and delete multiple DLL references from C# project programmatically Pin
Member 126484635-Aug-16 1:15
Member 126484635-Aug-16 1:15 
AnswerRe: How add and delete multiple DLL references from C# project programmatically Pin
dan!sh 5-Aug-16 1:48
professional dan!sh 5-Aug-16 1:48 
AnswerRe: How add and delete multiple DLL references from C# project programmatically Pin
BillWoodruff5-Aug-16 2:39
professionalBillWoodruff5-Aug-16 2:39 
GeneralRe: How add and delete multiple DLL references from C# project programmatically Pin
Member 126484636-Aug-16 2:27
Member 126484636-Aug-16 2:27 
QuestionTaking photos with a webcam in C # desktop Pin
hassan toghisny3-Aug-16 21:27
hassan toghisny3-Aug-16 21:27 
AnswerRe: Taking photos with a webcam in C # desktop Pin
Pete O'Hanlon3-Aug-16 21:39
mvePete O'Hanlon3-Aug-16 21:39 
AnswerRe: Taking photos with a webcam in C # desktop Pin
Bernhard Hiller3-Aug-16 21:44
Bernhard Hiller3-Aug-16 21:44 
QuestionCD burning in C # desktop Pin
hassan toghisny3-Aug-16 21:08
hassan toghisny3-Aug-16 21:08 
AnswerRe: CD burning in C # desktop Pin
OriginalGriff3-Aug-16 21:36
mveOriginalGriff3-Aug-16 21:36 
AnswerRe: CD burning in C # desktop Pin
Ravi Bhavnani12-Aug-16 5:52
professionalRavi Bhavnani12-Aug-16 5:52 
QuestionLINQ with ref parameter Pin
sunsher3-Aug-16 20:57
sunsher3-Aug-16 20:57 
AnswerRe: LINQ with ref parameter Pin
Pete O'Hanlon3-Aug-16 21:28
mvePete O'Hanlon3-Aug-16 21:28 
AnswerRe: LINQ with ref parameter Pin
Richard Deeming4-Aug-16 2:43
mveRichard Deeming4-Aug-16 2:43 
Well, you can, as Pete showed you. But it's not really a good idea, and probably won't work as you want it to.

It would be better to change the method so that it doesn't use a ref or out parameter. If you can't change it, then write a wrapper method.

You can either return a specific type to encapsulate the two returned values, or use a Tuple[^]. In C#7, there will even be built-in language support for tuples[^], which will make this much easier.
C#
static class YourExtensions
{
    // NB: In this case, a specific type would be better, since it's not
    //     immediately obvious which tuple item represents which value.
    
    public static Tuple<string, string> GetValue(this YourType id, int theParameter)
    {
        string strValue = null;
        string result = id.GetValue(theParameter, ref strValue);
        return Tuple.Create(result, strValue);
    }
}
...
var objCol = from id in ids
             let value = id.GetValue(2)
             where value.Item1 == "6"
             select new { id, strValue = value.Item2 };




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


QuestionCompress pdf/csv files to zip files Pin
NJdotnetdev3-Aug-16 8:34
NJdotnetdev3-Aug-16 8:34 
AnswerRe: Compress pdf/csv files to zip files Pin
OriginalGriff3-Aug-16 8:49
mveOriginalGriff3-Aug-16 8:49 
SuggestionRe: Compress pdf/csv files to zip files Pin
Richard Deeming3-Aug-16 10:24
mveRichard Deeming3-Aug-16 10:24 
GeneralRe: Compress pdf/csv files to zip files Pin
OriginalGriff3-Aug-16 10:49
mveOriginalGriff3-Aug-16 10:49 

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.