Click here to Skip to main content
15,894,540 members
Home / Discussions / C#
   

C#

 
GeneralRe: Multilingua virtual keyboard Pin
Mycroft Holmes8-May-16 22:32
professionalMycroft Holmes8-May-16 22:32 
GeneralRe: Multilingua virtual keyboard Pin
kelkeel8-May-16 23:04
kelkeel8-May-16 23:04 
GeneralRe: Multilingua virtual keyboard Pin
kelkeel8-May-16 17:37
kelkeel8-May-16 17:37 
AnswerRe: Multilingua virtual keyboard Pin
Bernhard Hiller8-May-16 20:48
Bernhard Hiller8-May-16 20:48 
QuestionOverloading default member in a C# class Pin
Kenneth Haugland7-May-16 19:25
mvaKenneth Haugland7-May-16 19:25 
AnswerRe: Overloading default member in a C# class Pin
Kenneth Haugland7-May-16 20:34
mvaKenneth Haugland7-May-16 20:34 
GeneralRe: Overloading default member in a C# class Pin
Peter_in_27807-May-16 20:50
professionalPeter_in_27807-May-16 20:50 
AnswerRe: Overloading default member in a C# class Pin
BillWoodruff8-May-16 5:18
professionalBillWoodruff8-May-16 5:18 
I don't know if this type of structure (using a List of Lists instead of an Array) is relevant to your concerns, it's something I experimented with some time ago:
C#
public class ComplexMatrix : List<List<Complex>>
{
    public ComplexMatrix() { }

    public ComplexMatrix(List<List<Complex>> list)
    {
        foreach(var lst in list) this.Add(lst);
    }

    public ComplexMatrix(IEnumerable<IEnumerable<Complex>> lstenum)
    {
        foreach (var lst in lstenum.ToList())
        {
            this.Add(lst.ToList());
        }
    }

    public ComplexMatrix(int rows, int cols)
    {
        List<Complex> complexrow;

        for (int i = 0; i < rows; i++)
        {
            complexrow = new List<Complex>(cols);
            this.Add(complexrow);

            for (int j = 0; j < cols; j++)
            {
                complexrow.Add(0.0d);
            }
        }
    }

    public Complex this[int row, int col]
    {
        set { this[row][col] = value; }

        get { return this[row][col];  }
    }

    public void SetValue(int row, int col, double real, double imaginary)
    {
        this[row][col] = new Complex(real, imaginary);
    }
}
Sample use:
C#
public void Test1()
{
    var repeated1 = Enumerable.Repeat(Enumerable.Repeat(new Complex(1, 1), 5), 5);
    
    var repeated2 = Enumerable.Repeat(Enumerable.Range(1, 6).Select(i => new Complex(i,i)), 6);
    
    ComplexMatrix cmatrix0 = new ComplexMatrix(repeated1);
    
    ComplexMatrix cmatrix1 = new ComplexMatrix(repeated2);
    
    ComplexMatrix cmatrix2 = new ComplexMatrix(4,4);
    
    cmatrix2.SetValue(0,0, 34.5, 666.4);

    cmatrix2[2,2] = 4.0;

    Complex c22 = cmatrix2[2,2];
    
    ComplexMatrix cmatrix3 = new ComplexMatrix
    {
        //{new List<Complex>{0.0, 1.0}},
        //{new List<Complex>{1.1, 1.2}}
    
         {Enumerable.Repeat(new Complex(0.0,0.0), 2).ToList()},
         {Enumerable.Repeat(new Complex(0.0,0.0), 2).ToList()}
    
        //{Enumerable.Range(1,5).Select(i => new Complex(i,0)).ToList()},
        //{Enumerable.Range.(1,5).Select(i => new Complex(i,0)).ToList()}
     };
    
     cmatrix3[1, 1] = new Complex(3.4, 45.66);
    
     Complex cmplx = cmatrix3[1, 1];
}
Other than an interesting experiment in self-education re Enumerable.Repeat, Enumerable.Range, auto-initializers, and Indexers, etc.: meaning of-it-all is left up to you Smile | :)
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008

GeneralRe: Overloading default member in a C# class Pin
Kenneth Haugland8-May-16 6:21
mvaKenneth Haugland8-May-16 6:21 
GeneralRe: Overloading default member in a C# class Pin
BillWoodruff8-May-16 18:41
professionalBillWoodruff8-May-16 18:41 
QuestionICloneable class with strings Pin
WorkOnlineClick2Wealth7-May-16 18:44
WorkOnlineClick2Wealth7-May-16 18:44 
AnswerRe: ICloneable class with strings Pin
OriginalGriff7-May-16 21:09
mveOriginalGriff7-May-16 21:09 
GeneralRe: ICloneable class with strings Pin
WorkOnlineClick2Wealth8-May-16 5:00
WorkOnlineClick2Wealth8-May-16 5:00 
GeneralRe: ICloneable class with strings Pin
OriginalGriff8-May-16 5:10
mveOriginalGriff8-May-16 5:10 
GeneralRe: ICloneable class with strings Pin
WorkOnlineClick2Wealth8-May-16 6:07
WorkOnlineClick2Wealth8-May-16 6:07 
GeneralRe: ICloneable class with strings Pin
Richard Deeming9-May-16 1:50
mveRichard Deeming9-May-16 1:50 
AnswerRe: ICloneable class with strings Pin
DaveAuld8-May-16 5:37
professionalDaveAuld8-May-16 5:37 
GeneralRe: ICloneable class with strings Pin
WorkOnlineClick2Wealth8-May-16 5:46
WorkOnlineClick2Wealth8-May-16 5:46 
QuestionC# chart library with interactive elements drawing Pin
WallaceCheshire7-May-16 3:41
WallaceCheshire7-May-16 3:41 
AnswerRe: C# chart library with interactive elements drawing Pin
Ravi Bhavnani7-May-16 18:30
professionalRavi Bhavnani7-May-16 18:30 
AnswerRe: C# chart library with interactive elements drawing Pin
Kenneth Haugland7-May-16 18:31
mvaKenneth Haugland7-May-16 18:31 
QuestionWinForms issues: (partial rant, partial sharing, totally a request for opinions, comments) Pin
BillWoodruff7-May-16 2:21
professionalBillWoodruff7-May-16 2:21 
AnswerRe: WinForms issues: (partial rant, partial sharing, totally a request for opinions, comments) Pin
CHill607-May-16 4:45
mveCHill607-May-16 4:45 
QuestionWhat does Bitmap.LockBits() do? Pin
Bernhard Hiller5-May-16 21:04
Bernhard Hiller5-May-16 21:04 
AnswerRe: What does Bitmap.LockBits() do? PinPopular
OriginalGriff5-May-16 21:54
mveOriginalGriff5-May-16 21:54 

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.