explicit-interface Questions
2
Solved
Code:
public interface IFoo
{
void Bar();
}
public class FooClass : IFoo
{
/// <summary> ... </summary>
/// <seealso cref="?"/> //How do you reference the IFoo.Bar() method
...
Reposeful asked 14/5, 2011 at 12:11
3
Solved
My question is somewhat related to this one: How does a generic constraint prevent boxing of a value type with an implicitly implemented interface?, but different because it shouldn't need a constr...
Indulgent asked 27/4, 2011 at 23:57
2
Solved
In Fortran, I need a procedure pointer inside a derived type that can point to one of several subroutines. This problem seems to be common on SO:
Fortran save procedure as property in derived type...
Durer asked 12/4, 2016 at 23:27
2
Solved
Why do explicit C# interface calls within a generic method that has an interface type constraint always call the base implementation?
For example, consider the following code:
public interface IB...
Lambrecht asked 22/7, 2016 at 21:45
2
I'm very new to Fortran, and for my research I need to get a monster of a model running, so I am learning as I am going along. So I'm sorry if I ask a "stupid" question.
I'm trying to compile (Mac...
Prescriptive asked 10/5, 2013 at 16:31
3
Solved
Is there a benefit implementing interfaces explicitly with respect to Dependency Injection?
As far as I understand, interfaces can be implemented either explicitly or implicitly:
interface IFoo
{...
Tamberg asked 28/7, 2015 at 11:17
2
I'm very aware of the fact that such a question has probably been posted already. Yet with the involvement of IoC in this case and a lot of code I've seen a colleague in a company I'm new in ...
Intimidate asked 8/9, 2014 at 14:45
2
Solved
I need to be able to determine if a given method or property comes from a particular interface and is explicitly implemented.
Has anyone done this and is it actually possible to get this informatio...
Erythro asked 4/7, 2011 at 14:10
5
Solved
I tend to favor explicit interface implementations over implicit ones, as I think programming against the interface as opposed to against an implementation, is generally preferable, plus when deali...
Dunnite asked 12/5, 2014 at 14:36
3
Solved
Code:
add-type @"
public interface IFoo
{
void Foo();
}
public class Bar : IFoo
{
void IFoo.Foo()
{
}
}
"@ -Language Csharp
$bar = New-Object Bar
($bar -as [IFoo]).Foo() # ERROR.
Err...
Raye asked 14/4, 2009 at 1:35
5
Solved
For the record, I've already seen this connect item but I can't really understand what would be the problem in supporting this.
Say I have the following code:
public interface IInterface
{
void ...
Copycat asked 17/8, 2011 at 8:52
2
Solved
I have a vexing error.
type Animal =
abstract member Name : string
type Dog (name : string) =
interface Animal with
member this.Name : string =
name
let pluto = new Dog("Pluto")
let name ...
Pipeline asked 29/1, 2013 at 23:8
3
Solved
When browsing ASP.NET MVC source code in codeplex, I found it is common to have a class explicitly implementing interface. The explicitly implemented method/property then invoke another "protected ...
Clan asked 11/11, 2008 at 10:12
3
Solved
Ok I derive a type B from a base class A.
A implements IDisposable explicit but I have to do additional cleanup in B, so I implement IDisposable in B:
interface IDisposable with
member i.Dispose(...
Gonorrhea asked 5/3, 2012 at 14:9
2
Solved
I just read the very good question/answers here about proper ways to use modules in Fortran. By writing subroutines in modules, one makes them explicit, in addition to clarifying the code.
To my k...
Shifflett asked 15/8, 2012 at 9:37
6
Solved
I have a very simple scenario : a "person" can be a "customer" or an "employee" of a company.
A "person" can be called by phone with the "Call" method.
Depending on which role the "person" plays ...
Necrose asked 7/12, 2010 at 17:47
9
Solved
More specifically, if I have:
public class TempClass : TempInterface
{
int TempInterface.TempProperty
{
get;
set;
}
int TempInterface.TempProperty2
{
get;
set;
}
public int TempProper...
Promissory asked 10/11, 2008 at 20:6
4
Solved
The other day i was looking at C# Boolean struct metadata.
Boolean implements the interface IConvertible. But looking at Boolean's members i could not see most of the IConvertible members.
I've d...
Thetis asked 1/9, 2011 at 9:47
3
Solved
public abstract class EntityBase { ... }
public interface IFoobar
{
void Foo<T>(int x)
where T : EntityBase, new();
}
public interface IFoobar<T>
where T : EntityBase, new()
{
voi...
Erlandson asked 19/7, 2011 at 0:18
3
Solved
If you look at the code for a read-only collection it does not have an "Add" method, but instead defines the ICollection<T>.Add(T Value) method (explicit interface implementation).
When I di...
Suisse asked 11/7, 2011 at 20:51
3
Solved
Although there are quite a lot of Q&As regarding IDisposable to be found on SO, I haven't found an answer to this yet:
I usually follow the practice that when one of my classes owns an IDispos...
Steffin asked 7/4, 2011 at 7:7
6
Solved
I believe it's pretty stupid, and I am a bit embarrassed to ask this kind of question, but I still could not find the answer:
I am looking at the class List<T> , which implemetns IList.
pub...
Ametropia asked 8/12, 2010 at 14:48
4
Solved
I was using the FtpWebResponse class and didn't see a Dispose method. It turns out that the class implements IDisposable, but does so explicitly so that you must first cast your instance to IDispos...
Vanburen asked 25/6, 2010 at 15:30
2
Solved
How can I use an object initializer with an explicit interface implementation in C#?
public interface IType
{
string Property1 { get; set; }
}
public class Type1 : IType
{
string IType.Property...
Viviennevivify asked 5/4, 2010 at 11:42
2
interface IBar { void Hidden(); }
class Foo : IBar { public void Visible() { /*...*/ } void IBar.Hidden() { /*...*/ } }
class Program
{
static T CallHidden1<T>(T foo) where T : Foo
{
foo...
Jerrome asked 5/2, 2010 at 16:30
1 Next >
© 2022 - 2024 — McMap. All rights reserved.