Click here to Skip to main content
12,349,169 members (63,984 online)
   

C#

 
GeneralRe: [Help] C# .txt Pin
omisheikh18-Nov-12 21:40
memberomisheikh18-Nov-12 21:40 
GeneralRe: [Help] C# .txt Pin
mumbot18-Nov-12 22:15
membermumbot18-Nov-12 22:15 
GeneralRe: [Help] C# .txt Pin
Zac Greve18-Nov-12 22:32
memberZac Greve18-Nov-12 22:32 
GeneralRe: [Help] C# .txt Pin
omisheikh18-Nov-12 22:34
memberomisheikh18-Nov-12 22:34 
GeneralRe: [Help] C# .txt Pin
mumbot19-Nov-12 0:02
membermumbot19-Nov-12 0:02 
AnswerRe: [Help] C# .txt Pin
Mathlab19-Nov-12 7:54
memberMathlab19-Nov-12 7:54 
QuestionAnother conversion problem (Prism) Pin
Andy_L_J18-Nov-12 11:07
memberAndy_L_J18-Nov-12 11:07 
AnswerRe: Another conversion problem (Prism) Pin
Pete O'Hanlon18-Nov-12 11:39
protectorPete O'Hanlon18-Nov-12 11:39 
GeneralRe: Another conversion problem (Prism) Pin
Andy_L_J18-Nov-12 11:47
memberAndy_L_J18-Nov-12 11:47 
QuestionSending bytes via internet? (info) Pin
clonze18-Nov-12 1:22
memberclonze18-Nov-12 1:22 
AnswerRe: Sending bytes via internet? (info) Pin
Eddy Vluggen18-Nov-12 1:50
memberEddy Vluggen18-Nov-12 1:50 
GeneralRe: Sending bytes via internet? (info) Pin
clonze18-Nov-12 3:54
memberclonze18-Nov-12 3:54 
GeneralRe: Sending bytes via internet? (info) Pin
Eddy Vluggen18-Nov-12 4:42
memberEddy Vluggen18-Nov-12 4:42 
QuestionConverting from VB.NET Pin
Andy_L_J17-Nov-12 21:39
memberAndy_L_J17-Nov-12 21:39 
In VB.NET I do this:

Public Property LogoutCommand As ICommand
...
LogoutCommand = New RelayCommand(AddressOf LogoutExecute, AddressOf CanLogoutExecute)

but when I try this in C#:
public ICommand LogoutCommand;
...
LogoutCommand = new RelayCommand(LogoutExecute, CanLogoutExecute);
...
private void LogoutExecute(){...}
private bool CanLogoutExecute()
{
 return true;
}
...
I get an error: "the best overloaded method match for RelayCommand(System.Action<object>, System.Predicate<object>) has some invalid arguments"

Here is the RelayCommand Class:
public class RelayCommand : ICommand
	{
		private readonly Action<Object> _execute;
		private readonly Predicate<Object> _canExecute;
 
		public RelayCommand(Action<object> execute): this(execute, null){	}
 
		public RelayCommand(Action<object> execute, Predicate<Object> canExecute)
		{
			if (execute == null)
			{
				throw new ArgumentException("execute");
			}
			_execute = execute;
			_canExecute = canExecute;
		}
 
		[DebuggerStepThrough()]
		public bool CanExecute(object parameter)
		{
			return _canExecute == null ? true : _canExecute(parameter);
		}
 
		public event EventHandler CanExecuteChanged
		{
			add { CommandManager.RequerySuggested += value; }
			remove { CommandManager.RequerySuggested -= value; }
		}
 
		public void Execute(object parameter)
		{
			_execute(parameter);
		}
 
	}
 
	public class RelayCommand<T> : ICommand
	{
		private readonly Action<T> _execute;
		private readonly Predicate<T> _canExecute;
 
		public RelayCommand(Action<T> execute): this(execute, null){}
 
		public RelayCommand(Action<T> execute, Predicate<T> canExecute)
		{
			if (execute == null)
			{
				throw new ArgumentException("execute");
			}
		}
 
		[DebuggerStepThrough()]
		public bool CanExecute(object parameter)
		{
			return _canExecute == null ? true : _canExecute((T)parameter);
		}
 
		public event EventHandler CanExecuteChanged
		{
			add { CommandManager.RequerySuggested += value; }
			remove { CommandManager.RequerySuggested -= value; }
		}
 
		public void Execute(object parameter)
		{
			_execute((T) parameter);
		}
 
	}

Any suggestions?
I don't speak Idiot - please talk slowly and clearly

"I have sexdaily. I mean dyslexia. Fcuk!"

Driven to the arms of Heineken by the wife


modified 18-Nov-12 3:54am.

AnswerRe: Converting from VB.NET Pin
DaveyM6917-Nov-12 22:23
mentorDaveyM6917-Nov-12 22:23 
GeneralRe: Converting from VB.NET Pin
Andy_L_J17-Nov-12 22:54
memberAndy_L_J17-Nov-12 22:54 
GeneralRe: Converting from VB.NET Pin
DaveyM6918-Nov-12 7:10
mentorDaveyM6918-Nov-12 7:10 
GeneralRe: Converting from VB.NET Pin
Andy_L_J18-Nov-12 11:12
memberAndy_L_J18-Nov-12 11:12 
Questionfiltering column value in DevExpress grid view Pin
eli1502197917-Nov-12 20:23
membereli1502197917-Nov-12 20:23 
AnswerRe: filtering column value in DevExpress grid view Pin
n.podbielski17-Nov-12 21:29
membern.podbielski17-Nov-12 21:29 
Questionhelp Pin
AMIR ESLAMI17-Nov-12 9:08
memberAMIR ESLAMI17-Nov-12 9:08 
AnswerRe: help Pin
Eddy Vluggen17-Nov-12 9:25
memberEddy Vluggen17-Nov-12 9:25 
AnswerRe: help Pin
Abhinav S18-Nov-12 20:58
mvpAbhinav S18-Nov-12 20:58 
QuestionAccess to created control Pin
KKW_acd17-Nov-12 5:18
memberKKW_acd17-Nov-12 5:18 
AnswerRe: Access to created control Pin
DaveyM6917-Nov-12 7:30
mentorDaveyM6917-Nov-12 7:30 
QuestionHow do you programatically open a file in c# to append? Pin
Xarzu17-Nov-12 1:05
memberXarzu17-Nov-12 1:05 
AnswerRe: How do you programatically open a file in c# to append? Pin
DaveyM6917-Nov-12 1:35
mentorDaveyM6917-Nov-12 1:35 
AnswerRe: How do you programatically open a file in c# to append? Pin
Eddy Vluggen17-Nov-12 9:32
memberEddy Vluggen17-Nov-12 9:32 
QuestionC# noob: Making Textbox entry a percentage, and Help with loops Pin
maul5916-Nov-12 18:46
membermaul5916-Nov-12 18:46 
AnswerRe: C# noob: Making Textbox entry a percentage, and Help with loops Pin
Richard MacCutchan16-Nov-12 20:43
mvpRichard MacCutchan16-Nov-12 20:43 
AnswerRe: C# noob: Making Textbox entry a percentage, and Help with loops Pin
OriginalGriff16-Nov-12 21:40
mvpOriginalGriff16-Nov-12 21:40 
GeneralRe: C# noob: Making Textbox entry a percentage, and Help with loops Pin
maul5916-Nov-12 22:20
membermaul5916-Nov-12 22:20 
GeneralRe: C# noob: Making Textbox entry a percentage, and Help with loops Pin
OriginalGriff16-Nov-12 22:26
mvpOriginalGriff16-Nov-12 22:26 
QuestionInterface issue when implementing Factory pattern Pin
MichCl16-Nov-12 8:36
memberMichCl16-Nov-12 8:36 
AnswerRe: Interface issue when implementing Factory pattern Pin
Eddy Vluggen16-Nov-12 9:01
memberEddy Vluggen16-Nov-12 9:01 
GeneralRe: Interface issue when implementing Factory pattern Pin
MichCl16-Nov-12 9:18
memberMichCl16-Nov-12 9:18 
GeneralRe: Interface issue when implementing Factory pattern Pin
Eddy Vluggen16-Nov-12 13:46
memberEddy Vluggen16-Nov-12 13:46 
GeneralRe: Interface issue when implementing Factory pattern Pin
MichCl19-Nov-12 2:20
memberMichCl19-Nov-12 2:20 
AnswerRe: Interface issue when implementing Factory pattern Pin
Eddy Vluggen19-Nov-12 2:32
memberEddy Vluggen19-Nov-12 2:32 
GeneralRe: Interface issue when implementing Factory pattern Pin
MichCl19-Nov-12 3:51
memberMichCl19-Nov-12 3:51 
GeneralRe: Interface issue when implementing Factory pattern Pin
Eddy Vluggen19-Nov-12 4:46
memberEddy Vluggen19-Nov-12 4:46 
GeneralRe: Interface issue when implementing Factory pattern Pin
MichCl19-Nov-12 9:38
memberMichCl19-Nov-12 9:38 
GeneralRe: Interface issue when implementing Factory pattern Pin
Eddy Vluggen19-Nov-12 9:53
memberEddy Vluggen19-Nov-12 9:53 
QuestionIssue in accessing 32 bit C++ DLL in Windows Server 2008 Pin
Kumaran Poongavanam16-Nov-12 8:32
memberKumaran Poongavanam16-Nov-12 8:32 
AnswerRe: Issue in accessing 32 bit C++ DLL in Windows Server 2008 Pin
Eddy Vluggen16-Nov-12 9:04
memberEddy Vluggen16-Nov-12 9:04 
GeneralRe: Issue in accessing 32 bit C++ DLL in Windows Server 2008 Pin
Kumaran Poongavanam16-Nov-12 10:09
memberKumaran Poongavanam16-Nov-12 10:09 
AnswerRe: Issue in accessing 32 bit C++ DLL in Windows Server 2008 Pin
Dave Kreskowiak16-Nov-12 11:55
mvpDave Kreskowiak16-Nov-12 11:55 
AnswerRe: Issue in accessing 32 bit C++ DLL in Windows Server 2008 Pin
jschell17-Nov-12 6:11
memberjschell17-Nov-12 6:11 
QuestionOutlook 2010 / C# - Hide or Remove item from ContextMenuContactItem + add custom item into it Pin
csharpcomeintome16-Nov-12 5:20
membercsharpcomeintome16-Nov-12 5:20 
QuestionException Handling Pin
Phanindra26116-Nov-12 3:21
memberPhanindra26116-Nov-12 3:21 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 24 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid