Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
AnswerRe: >'True'> is not satisfying Pin
jschell15-Jun-12 10:22
jschell15-Jun-12 10:22 
GeneralRe: >'True'> is not satisfying Pin
GrooverFromHolland15-Jun-12 12:30
GrooverFromHolland15-Jun-12 12:30 
GeneralRe: >'True'> is not satisfying Pin
Bernhard Hiller17-Jun-12 22:09
Bernhard Hiller17-Jun-12 22:09 
GeneralRe: >'True'> is not satisfying Pin
AstroBod42726-Jun-12 2:00
AstroBod42726-Jun-12 2:00 
GeneralRe: >'True'> is not satisfying Pin
AstroBod42726-Jun-12 1:58
AstroBod42726-Jun-12 1:58 
QuestionHow to implement error tracing for windows in c# application Pin
Member 385772214-Jun-12 22:34
Member 385772214-Jun-12 22:34 
AnswerRe: How to implement error tracing for windows in c# application Pin
Abhinav S15-Jun-12 20:28
Abhinav S15-Jun-12 20:28 
QuestionConsole Application based on delegates Pin
praveengb14-Jun-12 20:15
praveengb14-Jun-12 20:15 
hello friends,

I have an one console application w.r.t delegates but while executing am facing 2 errors, here is the code . .

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

namespace Delegates
{
delegate string StrMod(string str);

class DelegateTest
{
// replace spaces with hypens
static string ReplacesSpaces(string s)
{
Console.WriteLine("raplacing spaces with hypens.");
return s.Replace(' ','-');
}

//reomve spaces
static string RemoveSpaces(string s)
{
string temp="";
int i;
Console.WriteLine("Removing spaces.");
for(i=0;i<s.Length;i++)
{
if (s[i] != ' ')
{
temp = temp + s[i];


return temp;
}
}
}

//reverse a string
static string Reverse(string s)
{
string temp = "";
int i, j;
Console.WriteLine("Reversing string.");
for(j=0;i=s.Length-1;i--,j++)
{
if(i>=0)
{
temp=temp+s[i];
}
return temp;
}


}


static void Main(string[] args)
{

// construct a delegate

StrMod strOp = new StrMod(ReplacesSpaces);
string str;

//call method through delegate

str = strOp("This is a test.");
Console.WriteLine("Resulting string:" + str);
Console.WriteLine();

strOp = new StrMod(RemoveSpaces);
str = strOp("This is a test.");
Console.WriteLine("Resulting string:" + str);
Console.WriteLine();

strOp = new StrMod(Reverse);
str = strOp("This is a test.");
Console.WriteLine("Resulting string:" + str);
Console.WriteLine();

}


}
}

error:

Error 1 'Delegates.DelegateTest.RemoveSpaces(string)': not all code paths return a value C:\Users\Praveen\Documents\Visual Studio 2008\Projects\Delegates\Delegates\Program.cs 20 23 Delegates

Error 2 Cannot implicitly convert type 'int' to 'bool' C:\Users\Praveen\Documents\Visual Studio 2008\Projects\Delegates\Delegates\Program.cs 43 21 Delegates

As with concept wise delegates calling methods is right but am facing some problem in returning the value and in the for loop i.e, int to bool as both error shows

So plz concern this basic errors and give ur valuable feeds . .

Thanks,

praveen bellary
AnswerRe: Console Application based on delegates Pin
Sandeep Mewara14-Jun-12 20:42
mveSandeep Mewara14-Jun-12 20:42 
QuestionC# Installer Pin
Zeyad Jalil14-Jun-12 19:42
professionalZeyad Jalil14-Jun-12 19:42 
AnswerRe: C# Installer Pin
Sandeep Mewara14-Jun-12 20:35
mveSandeep Mewara14-Jun-12 20:35 
GeneralRe: C# Installer Pin
Zeyad Jalil14-Jun-12 20:48
professionalZeyad Jalil14-Jun-12 20:48 
GeneralRe: C# Installer Pin
Sandeep Mewara14-Jun-12 20:54
mveSandeep Mewara14-Jun-12 20:54 
AnswerRe: C# Installer Pin
Dave Kreskowiak15-Jun-12 2:03
mveDave Kreskowiak15-Jun-12 2:03 
AnswerRe: C# Installer Pin
Abhinav S15-Jun-12 20:26
Abhinav S15-Jun-12 20:26 
QuestionRunning a program as an Administrator Pin
MAW3014-Jun-12 16:24
MAW3014-Jun-12 16:24 
AnswerRe: Running a program as an Administrator Pin
Philippe Mori14-Jun-12 16:47
Philippe Mori14-Jun-12 16:47 
AnswerRe: Running a program as an Administrator Pin
Luc Pattyn14-Jun-12 17:54
sitebuilderLuc Pattyn14-Jun-12 17:54 
AnswerRe: Running a program as an Administrator Pin
Bernhard Hiller14-Jun-12 21:44
Bernhard Hiller14-Jun-12 21:44 
AnswerRe: Running a program as an Administrator Pin
DaveyM6915-Jun-12 0:28
professionalDaveyM6915-Jun-12 0:28 
Questionhow can i make double right click for button C# Pin
Member 401482414-Jun-12 9:40
Member 401482414-Jun-12 9:40 
SuggestionRe: how can i make double right click for button C# Pin
Sandeep Mewara14-Jun-12 10:50
mveSandeep Mewara14-Jun-12 10:50 
GeneralRe: how can i make double right click for button C# Pin
Wes Aday14-Jun-12 11:23
professionalWes Aday14-Jun-12 11:23 
AnswerRe: how can i make double right click for button C# Pin
PIEBALDconsult14-Jun-12 18:48
mvePIEBALDconsult14-Jun-12 18:48 
QuestionCOM/OLE: VB2010 code working - Similar C#2010 code not working? Pin
ToBick14-Jun-12 2:32
ToBick14-Jun-12 2:32 

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.