I've got interface:
Public Interface ICSIItem
Sub Initialize()
Event AnswerValueChanged(ByVal sender As Object, ByVal e As NotebookAnswerChangedEventArgs)
Property DataContext() As Object
End Interface
and converter http://www.developerfusion.com/tools/convert/vb-to-csharp/
public interface ICSIItem
{
void Initialize();
event AnswerValueChangedEventHandler AnswerValueChanged;
delegate void AnswerValueChangedEventHandler(object sender, NotebookAnswerChangedEventArgs e);
object DataContext { get; set; }
}
and resharper says me that delegate cannot be in interface.
This is NotebookAnswerChangedEventArgs class
public class NotebookAnswerChangedEventArgs : System.EventArgs
{
public string NewAnswer;
public string PreviousAnswer;
public NotebookAnswerChangedEventArgs(string newAnswer, string previousAnswer) : base()
{
this.NewAnswer = newAnswer;
this.PreviousAnswer = previousAnswer;
}
}
Could you help with this converting and please for better converter site, because that is very poor :/
C#, unlike VB.Net, doesn't allow an interface to declare nested types. This includes delegates. To fix this simply move the AnswerValueChangedEventHandler delegate outside the interface .
please note - your eventargs supports the use of EventHandler - I think in such cases you should use the EventHandler instead of defining your own delegates anew.
but I don't know any good converters. Why do you convert after all? Just put your VB.net code in a dll and use it from C# - if you write new one do it in C# and convert with time as the need arises.