Click here to Skip to main content
15,886,724 members
Home / Discussions / C#
   

C#

 
GeneralRe: Student admin management system C# console Pin
Member 1248538426-Apr-16 7:48
Member 1248538426-Apr-16 7:48 
QuestionRe: Student admin management system C# console Pin
Eddy Vluggen26-Apr-16 8:25
professionalEddy Vluggen26-Apr-16 8:25 
GeneralRe: Student admin management system C# console Pin
Matt T Heffron26-Apr-16 7:54
professionalMatt T Heffron26-Apr-16 7:54 
AnswerRe: Student admin management system C# console Pin
Member 1507847221-Feb-21 3:00
Member 1507847221-Feb-21 3:00 
AnswerRe: Student admin management system C# console Pin
Member 1507847221-Feb-21 3:12
Member 1507847221-Feb-21 3:12 
AnswerRe: Student admin management system C# console Pin
Member 1563833516-May-22 9:50
Member 1563833516-May-22 9:50 
QuestionImplicit conversion to generic Interface fails Pin
mirdana26-Apr-16 0:58
mirdana26-Apr-16 0:58 
AnswerRe: Implicit conversion to generic Interface fails Pin
Richard Deeming26-Apr-16 1:24
mveRichard Deeming26-Apr-16 1:24 
The generic interface is a red-herring. Your code will fail even with a non-generic interface, because the C# specification explicitly forbids it:

A class or struct is permitted to declare a conversion from a source type S to a target type T provided all of the following are true:
  • S and T are different types.
  • Either S or T is the class or struct type in which the operator declaration takes place.
  • Neither S nor T is object or an interface-type.
  • T is not a base class of S, and S is not a base class of T.

...
User-defined conversions are not allowed to convert from or to interface-types. In particular, this restriction ensures that no user-defined transformations occur when converting to an interface-type, and that a conversion to an interface-type succeeds only if the object being converted actually implements the specified interface-type.

Eric Lippert posted a great explanation for this restriction on StackOverflow:
More on implicit conversion operators and interfaces in C# (again) - Stack Overflow[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Implicit conversion to generic Interface fails Pin
mirdana26-Apr-16 19:01
mirdana26-Apr-16 19:01 
QuestionWhy do not save Login file in Server Explorer Pin
Member 1228884025-Apr-16 13:24
Member 1228884025-Apr-16 13:24 
AnswerRe: Why do not save Login file in Server Explorer PinPopular
OriginalGriff25-Apr-16 19:55
mveOriginalGriff25-Apr-16 19:55 
GeneralRe: Why do not save Login file in Server Explorer Pin
Sascha Lefèvre25-Apr-16 21:21
professionalSascha Lefèvre25-Apr-16 21:21 
GeneralRe: Why do not save Login file in Server Explorer Pin
Member 1228884026-Apr-16 5:11
Member 1228884026-Apr-16 5:11 
GeneralRe: Why do not save Login file in Server Explorer Pin
OriginalGriff26-Apr-16 5:23
mveOriginalGriff26-Apr-16 5:23 
GeneralRe: Why do not save Login file in Server Explorer Pin
Member 1228884026-Apr-16 16:21
Member 1228884026-Apr-16 16:21 
GeneralRe: Why do not save Login file in Server Explorer Pin
OriginalGriff26-Apr-16 19:58
mveOriginalGriff26-Apr-16 19:58 
GeneralRe: Why do not save Login file in Server Explorer Pin
Member 1228884027-Apr-16 4:54
Member 1228884027-Apr-16 4:54 
GeneralRe: Why do not save Login file in Server Explorer Pin
Pete O'Hanlon27-Apr-16 6:29
mvePete O'Hanlon27-Apr-16 6:29 
GeneralRe: Why do not save Login file in Server Explorer Pin
Sascha Lefèvre26-Apr-16 5:40
professionalSascha Lefèvre26-Apr-16 5:40 
GeneralRe: Why do not save Login file in Server Explorer Pin
OriginalGriff26-Apr-16 6:32
mveOriginalGriff26-Apr-16 6:32 
QuestionHelp with Listbox and comboBox Pin
Member 1231776424-Apr-16 23:40
Member 1231776424-Apr-16 23:40 
AnswerRe: Help with Listbox and comboBox Pin
koolprasad200324-Apr-16 23:55
professionalkoolprasad200324-Apr-16 23:55 
GeneralRe: Help with Listbox and comboBox Pin
Member 1231776424-Apr-16 23:56
Member 1231776424-Apr-16 23:56 
AnswerRe: Help with Listbox and comboBox Pin
BillWoodruff26-Apr-16 4:04
professionalBillWoodruff26-Apr-16 4:04 
GeneralRe: Help with Listbox and comboBox Pin
Sascha Lefèvre26-Apr-16 5:12
professionalSascha Lefèvre26-Apr-16 5:12 

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.