Click here to Skip to main content
15,909,373 members
Home / Discussions / C#
   

C#

 
QuestionParsing and edit an HTML-string Pin
anderslundsgard17-Jul-07 23:31
anderslundsgard17-Jul-07 23:31 
AnswerRe: Parsing and edit an HTML-string Pin
Martin#18-Jul-07 0:14
Martin#18-Jul-07 0:14 
AnswerRe: Parsing and edit an HTML-string Pin
Ravi Bhavnani18-Jul-07 2:20
professionalRavi Bhavnani18-Jul-07 2:20 
QuestionUDP multicast Pin
Amjath Rahman17-Jul-07 23:16
Amjath Rahman17-Jul-07 23:16 
QuestionList View search Pin
topksharma198217-Jul-07 23:10
topksharma198217-Jul-07 23:10 
AnswerRe: List View search Pin
Eduard Keilholz18-Jul-07 0:16
Eduard Keilholz18-Jul-07 0:16 
QuestionC#.net error: Attempt to read or write protected memory or often this is the indication that other memory is currupt Pin
Rao Rafique17-Jul-07 22:44
Rao Rafique17-Jul-07 22:44 
QuestionCannot implicitly convert type 'test.Str.StrEnumerator' to 'System.Collections.IEnumerator'. An explicit conversion exists (are you missing a cast?) Pin
abhishek.mumbai17-Jul-07 22:42
abhishek.mumbai17-Jul-07 22:42 
Hi Chetan
Well i went through your code which was given in one of your articles
"Enumerating Objects in C#" posted on "8 May 2007". No doubt that the article is very easy to understand but Well when i run this code
it gave the following error

"the Cannot implicitly convert type 'test.Str.StrEnumerator' to 'System.Collections.IEnumerator'. An explicit conversion exists (are you missing a cast?)"

May you please tell me how to get rid of this?

Thanks and Regards
Abhishek
abhishek@entech.us


using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace test
{
class Demo
{
public static void Main()
{
Str spp = new Str();
foreach (string i in spp)
System.Console.WriteLine(i);
}
}
class Str : IEnumerable // To impliment GetEnumerator method
{
string[] str_arr = new string[5] { "one", "two", "three", "four", "five" };
public IEnumerator GetEnumerator()
{
IEnumerator r = new StrEnumerator(this);
return r;
}
class StrEnumerator
{
int index;
Str sp;

public StrEnumerator(Str str_obj)
{
index = -1;
sp = str_obj;
}
public object Current
{
get
{
return sp.str_arr[index];
}
}
public bool MoveNext()
{
if (index < sp.str_arr.Length - 1)
{
index++;
return true;
}
return false;
}
public void Reset()
{
index = -1;
}
}
}
}


//error -- An explicit conversion exists (are you missing a cast?)

Abhishek
Mumbai
AnswerRe: Cannot implicitly convert type 'test.Str.StrEnumerator' to 'System.Collections.IEnumerator'. An explicit conversion exists (are you missing a cast?) Pin
J4amieC17-Jul-07 23:09
J4amieC17-Jul-07 23:09 
AnswerRe: Cannot implicitly convert type 'test.Str.StrEnumerator' to 'System.Collections.IEnumerator'. An explicit conversion exists (are you missing a cast?) Pin
Colin Angus Mackay17-Jul-07 23:10
Colin Angus Mackay17-Jul-07 23:10 
QuestionHow do you know the current level of datagrid when nested Pin
Muammar©17-Jul-07 22:33
Muammar©17-Jul-07 22:33 
QuestionBuild solution using NAnt [modified] Pin
deep717-Jul-07 22:31
deep717-Jul-07 22:31 
AnswerRe: Build solution using NAnt Pin
Scott Dorman18-Jul-07 7:24
professionalScott Dorman18-Jul-07 7:24 
QuestionC#.net error: Attempt to read or write protected memory or often this is the indication that other memory is currupt Pin
Rao Rafique17-Jul-07 22:15
Rao Rafique17-Jul-07 22:15 
AnswerRe: C#.net error: Attempt to read or write protected memory or often this is the indication that other memory is currupt Pin
Guffa17-Jul-07 22:21
Guffa17-Jul-07 22:21 
QuestionHow to Export an Excel (xls) document that's compatible to all office versions - C# Pin
OhrmaZd17-Jul-07 22:00
OhrmaZd17-Jul-07 22:00 
AnswerRe: How to Export an Excel (xls) document that's compatible to all office versions - C# Pin
originSH17-Jul-07 22:12
originSH17-Jul-07 22:12 
AnswerRe: How to Export an Excel (xls) document that's compatible to all office versions - C# Pin
DavieL17-Jul-07 22:30
DavieL17-Jul-07 22:30 
GeneralRe: How to Export an Excel (xls) document that's compatible to all office versions - C# Pin
OhrmaZd17-Jul-07 23:47
OhrmaZd17-Jul-07 23:47 
QuestionReport problem Pin
manoj_ce17-Jul-07 21:26
manoj_ce17-Jul-07 21:26 
QuestionVerify Certificate Revocation using x509chain offline check Pin
suprajav17-Jul-07 20:52
suprajav17-Jul-07 20:52 
QuestionSetting Focus problem... Pin
Dotnetkanna17-Jul-07 20:31
Dotnetkanna17-Jul-07 20:31 
Question.Net 2.0 Pin
razanabanu17-Jul-07 20:20
razanabanu17-Jul-07 20:20 
AnswerRe: .Net 2.0 Pin
Michael Sync17-Jul-07 20:33
Michael Sync17-Jul-07 20:33 
GeneralRe: .Net 2.0 Pin
Michael Sync17-Jul-07 20:34
Michael Sync17-Jul-07 20:34 

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.