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

C#

 
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 
GeneralRe: Compress pdf/csv files to zip files Pin
BillWoodruff3-Aug-16 19:47
professionalBillWoodruff3-Aug-16 19:47 
GeneralRe: Compress pdf/csv files to zip files Pin
Richard Deeming4-Aug-16 2:00
mveRichard Deeming4-Aug-16 2:00 
QuestionUsing SerializationEngine to input .obj file Pin
andycruce2-Aug-16 14:12
andycruce2-Aug-16 14:12 
AnswerRe: Using SerializationEngine to input .obj file Pin
Richard MacCutchan2-Aug-16 20:30
mveRichard MacCutchan2-Aug-16 20:30 
AnswerRe: Using SerializationEngine to input .obj file Pin
Pete O'Hanlon2-Aug-16 20:57
mvePete O'Hanlon2-Aug-16 20:57 
Questionhow to use cast linq concept Pin
Member 100705702-Aug-16 2:27
Member 100705702-Aug-16 2:27 
AnswerRe: how to use cast linq concept Pin
OriginalGriff2-Aug-16 2:42
mveOriginalGriff2-Aug-16 2:42 
QuestionEager loading question Pin
Member 93644551-Aug-16 21:53
Member 93644551-Aug-16 21:53 
AnswerRe: Eager loading question Pin
Nathan Minier2-Aug-16 2:58
professionalNathan Minier2-Aug-16 2:58 
AnswerRe: Eager loading question Pin
Agent__0073-Aug-16 18:52
professionalAgent__0073-Aug-16 18:52 
Question.. Pin
Daniyaltjm1-Aug-16 20:49
Daniyaltjm1-Aug-16 20:49 
AnswerRe: check the password wi-fi in c# Pin
Richard MacCutchan1-Aug-16 22:11
mveRichard MacCutchan1-Aug-16 22:11 
General... Pin
Daniyaltjm1-Aug-16 22:14
Daniyaltjm1-Aug-16 22:14 

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.