I've got a collection that implements an interface that extends both IList<T> and List.
public Interface IMySpecialCollection : IList<MyObject>, IList { ... }
That means I have two versions of the indexer.
I wish the generic implementation to be used, so I implement that one normally:
public MyObject this[int index] { .... }
I ...
Someone posted in a comment to another question about the meaning of the explicit keyword in C++. So, what does it mean?
...
What are the differences in implementing interfaces implicitly and explicitly in C#?
When should you use implicit and when should you use explicit?
Are there any pros and/or cons to one or the other?
...
I know you can use C++ keyword 'explicit' for constructors of classes to prevent an automatic conversion of type. Can you use this same command to prevent the conversion of parameters for a class method?
I have two class members, one which takes a bool as a param, the other an unsigned int. When I called the function with an int, the ...
Although using SQL FOR XML EXPLICIT is cumbersome, I find myself using it often. Since it allows full control over the generated XML document.
My problem is with perfomance, sometimes it would take more than 5 minutes to generate an XML document describing some financial data (invoices, bills .. etc.) for just one month!
So I was looki...
Today I happens to find that one C# class can inherit one interface both in implicit and explicit way. This surprises me. If C# works in this way, then one instance can behave differently when referenced in different way.
interface IFoo
{
void DoSomething();
}
class Foo : IFoo
{
#region IFoo Members
public void DoSomething(...
Having recently introduced an overload of a method the application started to fail.
Finally tracking it down, the new method is being called where I did not expect it to be.
We had
setValue( const std::wstring& name, const std::wstring& value );
std::wstring avalue( func() );
setValue( L"string", avalue );
std::wstring bvalue( func2()...
Had a coworker ask me this, and in my brain befuddled state I didn't have an answer:
Why is it that you can do:
string ham = "ham " + 4;
But not:
string ham = 4;
If there's an implicit cast/operation for string conversion when you are concatenating, why not the same when assigning it as a string? (Without doing some operator overl...
I ended up with something like the following code in a project I'm working on. I thought it was really odd that I was allowed to do it, but now I'm starting wonder what is most likely an architectural gaff on my part led me to this.
My questions to you are:
What exactly is this called?
What are some real world uses of this?
Why would...
I am getting this ambiguous reference error with some software that came from a vendor. The problem is, I need to keep both DLLs in my project, because various parts of it use code from both. So... I need to know the syntax for explicitly specifying the assembly. In other words, I want to do exactly what the error message is telling me t...
Hello,
My app needs to have a intent-filter that responds to a intent that has it's component set (a explicit intent.) Here is a example.
Intent i = new Intent();
i.setClassName("com.compareeverywhere","com.compareeverywhere.ScanActivity");
startActivity(i);
Just a simple intent-filter will not do - because the intent is made for a ...
Is it possible to assign a base class object to a derived class reference with an explicit typecast in C#?.
I have tried it and it creates a run-time error.
...
I'm trying to only return a few columns from a linq to sql query but if I do, it throws the exception:
Explicit construction of entity type 'InVision.Data.Employee' in query is not allowed
Here's the code:
return db.Employees.Select(e => new Employee()
{ EmployeeID = e.EmployeeID, FirstName = e.FirstName,
LastName = e....
I recently came across some weird looking class that had three constructors:
class Class
{
public:
explicit Class(int );
Class(AnotherClass );
explicit Class(YetAnotherClass, AnotherClass );
// ...
}
This doesn't really make sense to me - I thought the explicit keyword is to protect compiler chosen c...
Hi
I'm new to C# and learning new words. I find it difficult to understand what's the meaning of these two words when it comes to programming c#.
I looked in the dictionary for the meaning and here's what I got:
Implicit
"Something that is implicit is expressed in an indirect way."
"If a quality or element is implicit in som...
I'm trying to create the following structure:
[StructLayout(LayoutKind.Explicit, Size=14)]
public struct Message
{
[FieldOffset(0)]
public ushort X;
[FieldOffset(2)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst=5)]
private ushort[] Y;
[FieldOffset(12)]
public ushort Z...
I'm trying to explicitly link with a DLL. No other resources is available except the DLL file itself and some documentation about the classes and its member functions.
From the documentation, each class comes with its own
member typedef
example: typedef std::map<std::string,std::string> Server::KeyValueMap, typedef std::vector<std::...
hi folks,
i'm wondering why linkers can not do their job simply by consulting the information in the actual .dll files that got the actual implementation code ? i mean why linkers still need .lib files to do implicit linking ?
are not the export and relative address tables enough for such linking ?
is there anyway by which one can do i...
A pretty silly trivial question. The canonical example is f = open('filename'), but
f is not very descriptive. After not looking at code in a while,
you can forget whether it means
"file" or "function f(x)" or "fourier
transform results" or something else. EIBTI.
In Python, file is already taken by a function.
What else do you use...
// The Structure of the Container and the items
public interface IContainer <TItem> where TItem : IItem
{
}
public class AContainer : IContainer<ItemA>
{
}
public interface IItem
{
}
public class ItemA : IItem
{
}
// Client app
[Test]
public void Test ()
{
IContainer<IItem> container = new AContainer();
}
Question : In test t...