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

C#

 
GeneralRe: classification using fuzzy logic C# Pin
Richard MacCutchan30-May-14 21:57
mveRichard MacCutchan30-May-14 21:57 
QuestionC# project Dependency on .net frame work Pin
prateek chauhan29-May-14 18:12
prateek chauhan29-May-14 18:12 
AnswerRe: C# project Dependency on .net frame work Pin
Eddy Vluggen29-May-14 20:47
professionalEddy Vluggen29-May-14 20:47 
AnswerRe: C# project Dependency on .net frame work Pin
Mycroft Holmes29-May-14 20:47
professionalMycroft Holmes29-May-14 20:47 
AnswerRe: C# project Dependency on .net frame work Pin
Rob Philpott29-May-14 22:54
Rob Philpott29-May-14 22:54 
AnswerRe: C# project Dependency on .net frame work Pin
BobJanova30-May-14 0:11
BobJanova30-May-14 0:11 
AnswerRe: C# project Dependency on .net frame work Pin
Dave Kreskowiak30-May-14 4:18
mveDave Kreskowiak30-May-14 4:18 
Questionmultithreading issue Pin
Nico Haegens29-May-14 17:47
professionalNico Haegens29-May-14 17:47 
Hi, I have a small app that exposes a volatile singleton class in a class library. It is consumed by 2 applications that depend on it. Here is my intent: when I add an item to the collection in 1 program, I need the other program to see it. The other methods in this class that aren't included here are Save and Delete operations to the database that are called when I add or remove an item from the collection. My problem is that eventhough I stated the keyword volatile, the added item in the collection isn't shown in the collection in the other application.
Each viewmodel has a reference to the list it is contained in. When I want to save it, I add it to my list and the list saves it to my database.
So the way my app works:
- start app 1 that shows a list of viewmodels exposed by a "thread-safe" singleton class.
- start app 2 that adds a viewmodel to the list exposed by that same singleton class.
- list in app 1 is autmatically updated as it should be the same reference.
That last part apparantly isn't true when I test my code. Can you help me out ?
C#
public class CursistDepository : ObservableCollection<CursistViewModel>, IPersonDepository<CursistViewModel>
    {
        private static volatile CursistDepository instance;
        private static readonly object padlock = new object();
    
    public static CursistDepository Instance
        {
            get
            {
                if (instance == null)
                {
                    lock(padlock)
                    {
                        if(instance==null)
                        {
                            instance = new CursistDepository();
                            IEnumerable<ICursist> persons = Cursist.Select();
                            foreach (ICursist person in persons)
                            {
                                CursistViewModel model = new CursistViewModel(person);
                                instance.Add(model);
                            }
                        }
                    }
                }
                return instance;
            }
        }}

AnswerRe: multithreading issue Pin
Eddy Vluggen29-May-14 20:43
professionalEddy Vluggen29-May-14 20:43 
GeneralRe: multithreading issue Pin
Nico Haegens29-May-14 22:55
professionalNico Haegens29-May-14 22:55 
GeneralRe: multithreading issue Pin
Eddy Vluggen30-May-14 5:25
professionalEddy Vluggen30-May-14 5:25 
AnswerRe: multithreading issue Pin
Bernhard Hiller29-May-14 21:26
Bernhard Hiller29-May-14 21:26 
GeneralRe: multithreading issue Pin
Nico Haegens29-May-14 22:34
professionalNico Haegens29-May-14 22:34 
GeneralRe: multithreading issue Pin
Bernhard Hiller29-May-14 23:48
Bernhard Hiller29-May-14 23:48 
AnswerRe: multithreading issue Pin
BobJanova30-May-14 0:06
BobJanova30-May-14 0:06 
QuestionIIf Statement - Different Problem With RDLC Pin
Paramu197329-May-14 15:10
Paramu197329-May-14 15:10 
AnswerRe: IIf Statement - Different Problem With RDLC Pin
Karen Mitchelle29-May-14 16:04
professionalKaren Mitchelle29-May-14 16:04 
GeneralRe: IIf Statement - Different Problem With RDLC Pin
Paramu197329-May-14 19:15
Paramu197329-May-14 19:15 
Questionhow do i send notifications using web services? Pin
tanywali29-May-14 1:12
tanywali29-May-14 1:12 
AnswerRe: how do i send notifications using web services? Pin
BobJanova29-May-14 1:21
BobJanova29-May-14 1:21 
AnswerRe: how do i send notifications using web services? Pin
Pete O'Hanlon29-May-14 1:28
mvePete O'Hanlon29-May-14 1:28 
QuestionActivex code to print pdf files on client machine Pin
Sachin Mehndiratta29-May-14 1:03
Sachin Mehndiratta29-May-14 1:03 
AnswerRe: Activex code to print pdf files on client machine Pin
Pete O'Hanlon29-May-14 1:23
mvePete O'Hanlon29-May-14 1:23 
GeneralRe: Activex code to print pdf files on client machine Pin
Sachin Mehndiratta29-May-14 1:30
Sachin Mehndiratta29-May-14 1:30 
GeneralRe: Activex code to print pdf files on client machine Pin
Richard MacCutchan29-May-14 2:09
mveRichard MacCutchan29-May-14 2:09 

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.