Click here to Skip to main content
15,917,538 members
Home / Discussions / C#
   

C#

 
GeneralRe: thread priority Pin
George_George24-Mar-08 4:40
George_George24-Mar-08 4:40 
GeneralStrange stack trace Pin
Winkles20-Mar-08 15:56
Winkles20-Mar-08 15:56 
GeneralRe: Strange stack trace Pin
Guffa21-Mar-08 1:17
Guffa21-Mar-08 1:17 
GeneralRe: Strange stack trace Pin
Winkles21-Mar-08 6:21
Winkles21-Mar-08 6:21 
GeneralRe: Strange stack trace Pin
Winkles21-Mar-08 9:13
Winkles21-Mar-08 9:13 
Generalhelp with Databinding for visual studio .net in c # Pin
atonynh20-Mar-08 15:47
atonynh20-Mar-08 15:47 
GeneralRe: help with Databinding for visual studio .net in c # Pin
Christian Graus20-Mar-08 18:56
protectorChristian Graus20-Mar-08 18:56 
QuestionCan someone please tell me why the if Loop in my codes not working. Pin
ADTC#20-Mar-08 14:06
ADTC#20-Mar-08 14:06 
I thought maybe it was a datatype conflict and i checked the data type and the 2 variables are of the same data type but even when the conditions true, the if loop is not executed. heres the code and they are saved in 3 different files and here i am using interface to implement an ADT. And i am executing this code in Visual C# 2008 express edition. Can someone help e with this please, check he if condition.

<pre>

// File Name: ISet.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public interface ISet
{
int Cardinality
{
get;
}
void Add(Object element);

void Remove(Object element);
}

//File Name: Set.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class Set:ISet
{
private Object[] set1;
public int MAX = 20;
private int cardinality;
public Set()
{
this.set1 = new Object[MAX];
this.cardinality = 0;
}

public int Cardinality
{
get
{
return this.cardinality;
}
}

public void Add(Object element)
{
this.set1[this.cardinality] = element;
cardinality++;
}
public void Remove(Object element) //convert the set[i] to interger
{
Console.WriteLine("the element to be removed"+element);
for (int i = 0; i < this.cardinality; i++)
{

Console.WriteLine("The element in the set" + set1[i]);
Console.WriteLine("The element passed as the parameter" + element);
Console.WriteLine(set1[i].GetType());//checking the datatype;
Console.WriteLine(element.GetType());
if(set1[i] == element)
{
Console.WriteLine("The element to be removed found!!");
//This statement is not executed even when the condition is true!!!!!!
}

} //closing for loop
} // function end
} //end of the class

//File Name : Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
static void Main(string[] args)
{
Set set1 = new Set();
Console.WriteLine("The number of items in the set:" + set1.Cardinality);
set1.Add(5);
Console.WriteLine("The number of items in the set:" + set1.Cardinality);
set1.Remove((5));
}
}
</pre><pre></pre><pre></pre><pre></pre><pre></pre>
GeneralRe: Can someone please tell me why the if Loop in my codes not working. Pin
PIEBALDconsult20-Mar-08 15:14
mvePIEBALDconsult20-Mar-08 15:14 
Questionif condition not if loop (sorry for tht) Pin
ADTC#20-Mar-08 18:47
ADTC#20-Mar-08 18:47 
GeneralRe: Can someone please tell me why the if Loop in my codes not working. Pin
PIEBALDconsult20-Mar-08 15:21
mvePIEBALDconsult20-Mar-08 15:21 
GeneralLooking for good socket tutorials Pin
Jordanwb20-Mar-08 12:27
Jordanwb20-Mar-08 12:27 
GeneralRe: Looking for good socket tutorials Pin
Steve Echols20-Mar-08 19:09
Steve Echols20-Mar-08 19:09 
GeneralRe: Looking for good socket tutorials Pin
Jordanwb21-Mar-08 3:54
Jordanwb21-Mar-08 3:54 
QuestionClose MessageBox automaticly Pin
pcaeiro20-Mar-08 12:18
pcaeiro20-Mar-08 12:18 
GeneralRe: Close MessageBox automaticly Pin
Jordanwb20-Mar-08 12:29
Jordanwb20-Mar-08 12:29 
GeneralRe: Close MessageBox automaticly Pin
Christian Graus20-Mar-08 12:53
protectorChristian Graus20-Mar-08 12:53 
GeneralRe: Close MessageBox automaticly Pin
pcaeiro20-Mar-08 14:36
pcaeiro20-Mar-08 14:36 
GeneralRe: Close MessageBox automaticly Pin
Jordanwb20-Mar-08 15:38
Jordanwb20-Mar-08 15:38 
GeneralRe: Close MessageBox automaticly Pin
pcaeiro20-Mar-08 17:26
pcaeiro20-Mar-08 17:26 
GeneralRe: Close MessageBox automaticly Pin
PIEBALDconsult20-Mar-08 17:12
mvePIEBALDconsult20-Mar-08 17:12 
GeneralRe: Close MessageBox automaticly Pin
pcaeiro20-Mar-08 17:51
pcaeiro20-Mar-08 17:51 
GeneralRe: Close MessageBox automaticly Pin
MNFlyer21-Mar-08 11:17
MNFlyer21-Mar-08 11:17 
GeneralRe: Close MessageBox automaticly Pin
pcaeiro22-Mar-08 5:30
pcaeiro22-Mar-08 5:30 
QuestionHow to obtain external facing IP Address in C# Form Pin
PsychRich20-Mar-08 11:59
PsychRich20-Mar-08 11:59 

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.