|
by: MattC |
last post by:
Hi,
I have a collection class derived from ArrayList, it stores colletions of
objects from my objet model. I Didn't want to have to create a specialised
collection for each object type so I created the following static method.
public static MyCollection CreateGenericCollection(DataTable rates, Assembly
a, Type t)
{
MyCollection c = new MyCollection(); // create new collection
|
by: Gazarsgo |
last post by:
This seems to be a bit of a contradiction, but how can I construct a
Generic class using a System.Type variable that is assigned at run
time? Is there some parallel to the Generics concept that extends to
having strictly-typed classes at run-time?
I would gladly give up the compile-time errors if I could get rid of
all these CType()s :)
|
by: Vladimir Shiryaev |
last post by:
Hello!
Exception handling in generics seems to be a bit inconsistent to me.
Imagine, I have "MyOwnException" class derived from "ApplicationException".
I also have two classes "ThrowInConstructor" and "ThrowInFoo". First one
throws "MyOwnException" in constructor, second one in "Foo()" method. There
is a "GenericCatch" generics class able to accept "ThrowInConstructor" and
"ThrowInFoo" as type parameter "<T>". There are two methods in...
|
by: Cedric Rogers |
last post by:
I wasn't sure if I could do this. I believe I am stretching the capability of
what generics can do for me but here goes.
I have a generic delegate defined as
public delegate bool RuleDelegate<T>(T item);
In my class my goal is to use a generic list collection to contain my
generic delegates. This will allow me to pass this List to another library
and call this list of functions. This could provide a new way to build rule
base...
|
by: LordHog |
last post by:
Hello all,
I recently ran into a strange behavior which I don't understand. I
have two 'Add' method which a slightly different signature which they
look like
public void Add( string varName, ScriptVarType type, object value )
public void Add( string varName, ScriptVarType type, object values
)
|
|
by: Ajeet |
last post by:
hi
I am having some difficulty in casting using generics. These are the
classes.
public interface IProvider<PROF>
where PROF : IProviderProfile
{
//Some properties/methods
}
|
by: =?Utf-8?B?SGF5U2VlZA==?= |
last post by:
Is there some way to use Generics in dynamic code using the
Type.GetType("MyClassName")
as an argument?
List<Type.GetType("MyClassName") oList = new
List<Type.GetType("MyClassName") >
.... or is there a way to declare a generic using strings that hold class
|
by: colin |
last post by:
Hi,
Is there a way of doing simple code generation inside visual c# express
such as similar to preprocessing in c++ ?
I need to generate a library for some vector maths,
but I need to implement it for different types wich would be difficult to do
with
generic types and/or interfaces for numerous reasons
and would probaly sufer a considerable performance hit.
|
by: =?Utf-8?B?TXJOb2JvZHk=?= |
last post by:
Say I have a class that has a generics List as follows:
public List<MyClassmyClassList = new List<MyClass>();
and I want to create another class which tries to add an element of MyClass
to that list, but it is not explicitly creating an instance of MyClass, but
instead using the Activator to create an instance based on it's type name.
How can I accomplish this in C# using reflection?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|