Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
GeneralRe: Convert dateTime components to hex then byte[] Pin
MichCl20-Aug-12 5:55
MichCl20-Aug-12 5:55 
GeneralRe: Convert dateTime components to hex then byte[] Pin
Pete O'Hanlon20-Aug-12 6:06
mvePete O'Hanlon20-Aug-12 6:06 
GeneralRe: Convert dateTime components to hex then byte[] Pin
MichCl20-Aug-12 7:04
MichCl20-Aug-12 7:04 
AnswerRe: Convert dateTime components to hex then byte[] Pin
SledgeHammer0120-Aug-12 6:42
SledgeHammer0120-Aug-12 6:42 
GeneralRe: Convert dateTime components to hex then byte[] Pin
MichCl20-Aug-12 7:37
MichCl20-Aug-12 7:37 
GeneralRe: Convert dateTime components to hex then byte[] Pin
DaveyM6920-Aug-12 11:12
professionalDaveyM6920-Aug-12 11:12 
GeneralRe: Convert dateTime components to hex then byte[] Pin
MichCl21-Aug-12 1:52
MichCl21-Aug-12 1:52 
GeneralRe: Convert dateTime components to hex then byte[] Pin
DaveyM6921-Aug-12 7:55
professionalDaveyM6921-Aug-12 7:55 
GeneralRe: Convert dateTime components to hex then byte[] Pin
MichCl21-Aug-12 8:47
MichCl21-Aug-12 8:47 
QuestionWPF: use enum as index for Binding Pin
LionAM19-Aug-12 23:38
LionAM19-Aug-12 23:38 
AnswerRe: WPF: use enum as index for Binding Pin
Pete O'Hanlon20-Aug-12 0:27
mvePete O'Hanlon20-Aug-12 0:27 
GeneralRe: WPF: use enum as index for Binding Pin
LionAM20-Aug-12 1:34
LionAM20-Aug-12 1:34 
GeneralRe: WPF: use enum as index for Binding Pin
Pete O'Hanlon20-Aug-12 1:37
mvePete O'Hanlon20-Aug-12 1:37 
GeneralRe: WPF: use enum as index for Binding Pin
LionAM20-Aug-12 1:47
LionAM20-Aug-12 1:47 
AnswerRe: WPF: use enum as index for Binding Pin
Eddy Vluggen20-Aug-12 0:48
professionalEddy Vluggen20-Aug-12 0:48 
I dunno anything about WPF, but to answer the question; yes to all. To answer the questions in reverse order;
LionAM wrote:

Additionally: Can I use an expression (for example an extension method
C#
TestEnum.Enum1.DoSomething()

Yes, see example-code below (tested under Mono);
C#
public enum TestEnum: int
{
    Enum1 = 3,
    EnumZwei = 9
}

public static class MyExt
{
    public static TestEnum DoSomething(this TestEnum e)
    {
        return TestEnum.EnumZwei;
    }
}
// and then calling it, which looks plain weird;
class Program
{    
    public static void Main (string[] args)
    {    
        Console.WriteLine(TestEnum.Enum1.DoSomething());
    }
}


LionAM wrote:
I hoped that I could use something like
C#
<CheckBox IsChecked="{Binding Obj[TestEnum.Enum1]}" ...

with some helper object providing an index operator. The first works, the second does not...

With a little helper you can. Add the method below;
C#
public static class MyExt
{
    public static string Parse(this string SomeString)
    {
        foreach (var enumVal in Enum.GetValues(typeof(TestEnum)))
        {
            string enumValAsString = String.Format("{0}.{1}", 
                enumVal.GetType().Name, enumVal);
            int enumValAsInt = (int)enumVal;
            if (SomeString.Contains(enumValAsString))
            {
                SomeString = SomeString.Replace(enumValAsString, enumValAsInt.ToString());
            }
        }
        return SomeString;
    }
}
// and an example on using that;
class Program
{    
    public static void Main (string[] args)
    {    
        string s = "{Binding Obj[TestEnum.Enum1]}";
        Console.WriteLine(s);
        Console.WriteLine(s.Parse());
    }
}

Enjoy Smile | :)
Bastard Programmer from Hell Suspicious | :suss:
if you can't read my code, try converting it here[^]

GeneralRe: WPF: use enum as index for Binding Pin
LionAM20-Aug-12 1:41
LionAM20-Aug-12 1:41 
GeneralRe: WPF: use enum as index for Binding Pin
Eddy Vluggen20-Aug-12 1:47
professionalEddy Vluggen20-Aug-12 1:47 
QuestionTypedDataSet synchronisation using compact framework Pin
VenkataRamana.Gali19-Aug-12 23:11
VenkataRamana.Gali19-Aug-12 23:11 
AnswerRe: TypedDataSet synchronisation using compact framework Pin
Pete O'Hanlon20-Aug-12 0:17
mvePete O'Hanlon20-Aug-12 0:17 
GeneralRe: TypedDataSet synchronisation using compact framework Pin
VenkataRamana.Gali20-Aug-12 4:02
VenkataRamana.Gali20-Aug-12 4:02 
QuestionWCF SErvice Authentication Pin
pravin_mun19-Aug-12 20:21
pravin_mun19-Aug-12 20:21 
QuestionGetting File Path Pin
ASPnoob18-Aug-12 17:02
ASPnoob18-Aug-12 17:02 
AnswerRe: etGetting File Path Pin
Richard Andrew x6418-Aug-12 17:17
professionalRichard Andrew x6418-Aug-12 17:17 
GeneralRe: etGetting File Path Pin
ASPnoob18-Aug-12 17:20
ASPnoob18-Aug-12 17:20 
GeneralRe: etGetting File Path Pin
Richard Andrew x6418-Aug-12 17:24
professionalRichard Andrew x6418-Aug-12 17:24 

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.