Click here to Skip to main content
15,889,462 members
Home / Discussions / C#
   

C#

 
SuggestionRe: Catch Win+Left (Aero-Snap)? Pin
Richard Deeming20-Apr-15 2:34
mveRichard Deeming20-Apr-15 2:34 
QuestionHow do I add an object to a list within a class? Pin
Doncal18-Apr-15 9:43
Doncal18-Apr-15 9:43 
AnswerRe: How do I add an object to a list within a class? Pin
Pete O'Hanlon18-Apr-15 10:06
mvePete O'Hanlon18-Apr-15 10:06 
AnswerRe: How do I add an object to a list within a class? Pin
Sascha Lefèvre18-Apr-15 10:09
professionalSascha Lefèvre18-Apr-15 10:09 
AnswerRe: How do I add an object to a list within a class? Pin
Doncal18-Apr-15 10:24
Doncal18-Apr-15 10:24 
GeneralRe: How do I add an object to a list within a class? Pin
Sascha Lefèvre18-Apr-15 10:27
professionalSascha Lefèvre18-Apr-15 10:27 
GeneralRe: How do I add an object to a list within a class? Pin
BillWoodruff18-Apr-15 17:28
professionalBillWoodruff18-Apr-15 17:28 
GeneralRe: How do I add an object to a list within a class? Pin
Sascha Lefèvre19-Apr-15 0:44
professionalSascha Lefèvre19-Apr-15 0:44 
Thank you, Bill!

Probably I just managed to express my idea in an obfuscated way Smile | :)

This is what I meant:
C#
class ListEncapsulation
{
    // pre .NET 4.5
    public ReadOnlyCollection<int> Example1 { get { return EncapsulatedList.AsReadOnly(); } }
    public IEnumerable<int> Example2 { get { return EncapsulatedList.AsReadOnly(); } }

    // .NET 4.5
    public IReadOnlyList<int> Example3 { get { return EncapsulatedList.AsReadOnly(); } }

    private List<int> EncapsulatedList = new List<int>();

    // + methods that expose the allowed manipulations on the list
}

This answer on Stackoverflow shows the idea in some more detail:
http://stackoverflow.com/a/7445676/4320056[^]
And a short article on the readonly-collection-interfaces new in .NET 4.5:
http://visualstudiomagazine.com/articles/2012/08/07/new-read-only-collection-interfaces-for-net.aspx[^]

cheers, Sascha
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

QuestionWindows remote desktop but all in HTML Pin
Dr Gadgit18-Apr-15 6:23
Dr Gadgit18-Apr-15 6:23 
QuestionCreate Chart in Excel with C# Pin
Member 836750218-Apr-15 2:17
Member 836750218-Apr-15 2:17 
AnswerRe: Create Chart in Excel with C# Pin
Brisingr Aerowing18-Apr-15 12:24
professionalBrisingr Aerowing18-Apr-15 12:24 
Questionfloat to and from frequency Pin
DaveyM6917-Apr-15 10:06
professionalDaveyM6917-Apr-15 10:06 
AnswerRe: float to and from frequency Pin
Sascha Lefèvre17-Apr-15 11:02
professionalSascha Lefèvre17-Apr-15 11:02 
GeneralRe: float to and from frequency Pin
DaveyM6917-Apr-15 13:16
professionalDaveyM6917-Apr-15 13:16 
GeneralRe: float to and from frequency Pin
Sascha Lefèvre17-Apr-15 13:48
professionalSascha Lefèvre17-Apr-15 13:48 
GeneralRe: float to and from frequency Pin
DaveyM6917-Apr-15 14:15
professionalDaveyM6917-Apr-15 14:15 
GeneralRe: float to and from frequency Pin
Sascha Lefèvre17-Apr-15 14:29
professionalSascha Lefèvre17-Apr-15 14:29 
GeneralRe: float to and from frequency Pin
DaveyM6918-Apr-15 0:01
professionalDaveyM6918-Apr-15 0:01 
GeneralRe: float to and from frequency Pin
Sascha Lefèvre18-Apr-15 3:53
professionalSascha Lefèvre18-Apr-15 3:53 
AnswerRe: float to and from frequency Pin
Mycroft Holmes17-Apr-15 22:51
professionalMycroft Holmes17-Apr-15 22:51 
GeneralRe: float to and from frequency Pin
DaveyM6918-Apr-15 0:03
professionalDaveyM6918-Apr-15 0:03 
QuestionRe: float to and from frequency Pin
Kenneth Haugland17-Apr-15 23:23
mvaKenneth Haugland17-Apr-15 23:23 
AnswerRe: float to and from frequency Pin
DaveyM6918-Apr-15 0:00
professionalDaveyM6918-Apr-15 0:00 
GeneralRe: float to and from frequency Pin
Kenneth Haugland18-Apr-15 0:40
mvaKenneth Haugland18-Apr-15 0:40 
GeneralRe: float to and from frequency Pin
Kenneth Haugland18-Apr-15 0:43
mvaKenneth Haugland18-Apr-15 0:43 

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.