473,729 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Generic Generics Problem

Hello everyone,
I'm writing because I'm frustrated with the implementation of C#'s
generics, and need a workaround. I come from a Java background, and
am currently writing a portion of an application that needs
implementations in both Java and C#. I have the Java side done, and
it works fantastic, and the C# side is nearly there. The problem I'm
running into has to do with the differences in implementations of
Generics between the two languages. I would like to use a class that
is defined with Generics, only without having to declare its type
everywhere.

For example, suppose I'm using an IList, and in one location, I
declare it using a generic type of <String>. Now, in a different
class, I'd like to store that list as a field, but I don't want to
store the type associated with it. If I'm required to store the type
with the field (such as <pre>private IList<Stringfie ldName;</pre>,
then the class in which it is stored will be required to be generic,
and any classes that store instances of it will also need to be
generic, ad infinitum, until all my code is generified all over the
place (which I don't want!). Now, the example presented here is
easily solvable, since the IList interface is declared twice (once in
System.Collecti ons as a non-generic version, and once in
System.Collecti ons.Generic as a generic version).

Here's a code example of the Java equivalent, followed by the
(illegal) desired C# syntax:
<pre>
public interface ExampleInterfac e<Type>
{
// some member methods in here
}

public class ExampleImpl<Typ eimplements ExampleInterfac e<Type>
{
// method implementations here
}

public class SampleClass
{
private ExampleInterfac e mExampleInterfa ce;

public void setExampleInter face(ExampleInt erface
pExampleInterfa ce)
{
mExampleInterfa ce = pExampleInterfa ce;
}
}

public class SampleBuilder
{
private SampleClass mSampleClass;

public SampleBuilder()
{
mSampleClass = new SampleClass();
mSampleClass.se tExampleInterfa ce(new ExampleImpl<Str ing>());
}
}

// end Java example
</pre>

Desired C# implementation:
<pre>
public interface ExampleInterfac e<Type>
{
// some member methods in here
}

public class ExampleImpl<Typ e: ExampleInterfac e<Type>
{
// method implementations here
}

public class SampleClass
{
private ExampleInterfac e exampleInterfac e;

public void SetExampleInter face(ExampleInt erface exampleInterfac e)
{
this.exampleInt erface = exampleInterfac e;
}
}

public class SampleBuilder
{
private SampleClass sampleClass;

public SampleBuilder()
{
this.sampleClas s = new SampleClass();
this.sampleClas s.SetExampleInt erface(new
ExampleImpl<Str ing>());
}
}

// end C# example
</pre>

So, in the C# example, if I'm forced to store the instance of
<pre>ExampleInt erface</prewith its generic type, then
<pre>SampleClas s</prewill have to be defined as a Generic class, and
stored in SampleBuilder with its generic type, which will then force
<pre>SampleClas s</preto also be defined as a Generic class, and so
on and so forth.

Is there any way to do what I'd like, or am I forced to abandon the
use of Generics completely in C#?

Thanks in advance!
Respectfully,
Robert Kausch

May 17 '07 #1
13 3830
On 17 May 2007 12:10:50 -0700, "rk*****@gmail. com" <rk*****@gmail. com>
wrote:
>Hello everyone,
I'm writing because I'm frustrated with the implementation of C#'s
generics, and need a workaround. I come from a Java background, and
am currently writing a portion of an application that needs
implementation s in both Java and C#. I have the Java side done, and
it works fantastic, and the C# side is nearly there. The problem I'm
running into has to do with the differences in implementations of
Generics between the two languages. I would like to use a class that
is defined with Generics, only without having to declare its type
everywhere.

For example, suppose I'm using an IList, and in one location, I
declare it using a generic type of <String>. Now, in a different
class, I'd like to store that list as a field, but I don't want to
store the type associated with it. If I'm required to store the type
with the field (such as <pre>private IList<Stringfie ldName;</pre>,
then the class in which it is stored will be required to be generic,
and any classes that store instances of it will also need to be
generic, ad infinitum, until all my code is generified all over the
place (which I don't want!). Now, the example presented here is
easily solvable, since the IList interface is declared twice (once in
System.Collect ions as a non-generic version, and once in
System.Collect ions.Generic as a generic version).

Here's a code example of the Java equivalent, followed by the
(illegal) desired C# syntax:
<pre>
public interface ExampleInterfac e<Type>
{
// some member methods in here
}

public class ExampleImpl<Typ eimplements ExampleInterfac e<Type>
{
// method implementations here
}

public class SampleClass
{
private ExampleInterfac e mExampleInterfa ce;

public void setExampleInter face(ExampleInt erface
pExampleInterf ace)
{
mExampleInterfa ce = pExampleInterfa ce;
}
}

public class SampleBuilder
{
private SampleClass mSampleClass;

public SampleBuilder()
{
mSampleClass = new SampleClass();
mSampleClass.se tExampleInterfa ce(new ExampleImpl<Str ing>());
}
}

// end Java example
</pre>

Desired C# implementation:
<pre>
public interface ExampleInterfac e<Type>
{
// some member methods in here
}

public class ExampleImpl<Typ e: ExampleInterfac e<Type>
{
// method implementations here
}

public class SampleClass
{
private ExampleInterfac e exampleInterfac e;

public void SetExampleInter face(ExampleInt erface exampleInterfac e)
{
this.exampleInt erface = exampleInterfac e;
}
}

public class SampleBuilder
{
private SampleClass sampleClass;

public SampleBuilder()
{
this.sampleClas s = new SampleClass();
this.sampleClas s.SetExampleInt erface(new
ExampleImpl<St ring>());
}
}

// end C# example
</pre>

So, in the C# example, if I'm forced to store the instance of
<pre>ExampleIn terface</prewith its generic type, then
<pre>SampleCla ss</prewill have to be defined as a Generic class, and
stored in SampleBuilder with its generic type, which will then force
<pre>SampleCla ss</preto also be defined as a Generic class, and so
on and so forth.

Is there any way to do what I'd like, or am I forced to abandon the
use of Generics completely in C#?

Thanks in advance!
Respectfully ,
Robert Kausch
Maybe:
public interface ExampleInterfac eNG {}

public interface ExampleInterfac e<T: ExampleInterfac eNG {}

public class SampleClass
{
private ExampleInterfac eNG exampleInterfac e;

public void SetExampleInter face(ExampleInt erfaceNG
exampleInterfac e)
{
this.exampleInt erface = exampleInterfac e;
}
}

--
Ludwig
http://www.coders-lab.be
May 17 '07 #2
[Removed microsoft.publi c.dotnet.csharp .general which isn't a valid
newsgroup]

rk*****@gmail.c om <rk*****@gmail. comwrote:

<snip>
Is there any way to do what I'd like, or am I forced to abandon the
use of Generics completely in C#?
Well, you've effectively abandoned the use of generics in Java already,
by using the raw type instead of the generic type. Java generics are
relatively weak, only working at compile-time using type erasure. C#
and .NET generics are stronger, maintaining the type information at
execution time too.

Now, what you're trying to do is effectively abandon the type safety
that generics provides by saying

private ExampleInterfac e exampleInterfac e;

What information is that meant to convey? How would you use it? You no
longer have any idea what types any of the methods take.

So basically, the equivalent to the Java code is to abandon generics.
I'd stick to real generics in the C# code - it will only "infect" you
with generics as far as you want the types that you're talking about to
be generic. Once you get to the stage that you know which real type you
want to use, you can specify that and no longer make the type itself
generic. Basically, if you want the benefits of generics, you've got to
be able to provide the user of a class with a way of specifying the
type arguments to use for those benefits, which you can't do if you
don't have type parameters.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
May 17 '07 #3
On May 17, 1:49 pm, Jon Skeet [C# MVP] <s...@pobox.com wrote:
<snip>
Well, you've effectively abandoned the use of generics in Java already,
by using the raw type instead of the generic type. Java generics are
relatively weak, only working at compile-time using type erasure. C#
and .NET generics are stronger, maintaining the type information at
execution time too.

Now, what you're trying to do is effectively abandon the type safety
that generics provides by saying

private ExampleInterfac e exampleInterfac e;

What information is that meant to convey? How would you use it? You no
longer have any idea what types any of the methods take.

So basically, the equivalent to the Java code is to abandon generics.
I'd stick to real generics in the C# code - it will only "infect" you
with generics as far as you want the types that you're talking about to
be generic. Once you get to the stage that you know which real type you
want to use, you can specify that and no longer make the type itself
generic. Basically, if you want the benefits of generics, you've got to
be able to provide the user of a class with a way of specifying the
type arguments to use for those benefits, which you can't do if you
don't have type parameters.
Hi Jon-

Thanks for the quick reply. If I recall correctly, since Java uses
generics in such a way as to not break the legacy JVMs, it basically
replaces all instances of "T" with the actual type at compile time,
and effectively retains the type safety at run time (you'll get a
class cast exception if you try to put something other than type T
into the object, for example). I realize that C# generics are not
implemented this way, which is the crux of the situation. Basically,
I suppose I'm asking for the impossible: the type safety of generics
to be preserved, regardless of how the pointer to the object is being
used (this probably would work in C++ using templates, since n classes
are generated, one for each variation of type T used). Does the
underlying object preserve the type information after it's created, or
is that always handled by the syntax of the declaration (e.g.
List<Stringalwa ys knows that it can only take a String because the
syntax says <String>, not because the List object preserved String
internally)?

Thanks again!
Robert

May 17 '07 #4
On May 17, 1:22 pm, Ludwig <ludwig.stuyck( remove)@telenet .bewrote:
On 17 May 2007 12:10:50 -0700, "rkau...@gmail. com" <rkau...@gmail. com>
wrote:
Hello everyone,
I'm writing because I'm frustrated with the implementation of C#'s
generics, and need a workaround. I come from a Java background, and
am currently writing a portion of an application that needs
implementations in both Java and C#. I have the Java side done, and
it works fantastic, and the C# side is nearly there. The problem I'm
running into has to do with the differences in implementations of
Generics between the two languages. I would like to use a class that
is defined with Generics, only without having to declare its type
everywhere.
For example, suppose I'm using an IList, and in one location, I
declare it using a generic type of <String>. Now, in a different
class, I'd like to store that list as a field, but I don't want to
store the type associated with it. If I'm required to store the type
with the field (such as <pre>private IList<Stringfie ldName;</pre>,
then the class in which it is stored will be required to be generic,
and any classes that store instances of it will also need to be
generic, ad infinitum, until all my code is generified all over the
place (which I don't want!). Now, the example presented here is
easily solvable, since the IList interface is declared twice (once in
System.Collecti ons as a non-generic version, and once in
System.Collecti ons.Generic as a generic version).
Here's a code example of the Java equivalent, followed by the
(illegal) desired C# syntax:
<pre>
public interface ExampleInterfac e<Type>
{
// some member methods in here
}
public class ExampleImpl<Typ eimplements ExampleInterfac e<Type>
{
// method implementations here
}
public class SampleClass
{
private ExampleInterfac e mExampleInterfa ce;
public void setExampleInter face(ExampleInt erface
pExampleInterfa ce)
{
mExampleInterfa ce = pExampleInterfa ce;
}
}
public class SampleBuilder
{
private SampleClass mSampleClass;
public SampleBuilder()
{
mSampleClass = new SampleClass();
mSampleClass.se tExampleInterfa ce(new ExampleImpl<Str ing>());
}
}
// end Java example
</pre>
Desired C# implementation:
<pre>
public interface ExampleInterfac e<Type>
{
// some member methods in here
}
public class ExampleImpl<Typ e: ExampleInterfac e<Type>
{
// method implementations here
}
public class SampleClass
{
private ExampleInterfac e exampleInterfac e;
public void SetExampleInter face(ExampleInt erface exampleInterfac e)
{
this.exampleInt erface = exampleInterfac e;
}
}
public class SampleBuilder
{
private SampleClass sampleClass;
public SampleBuilder()
{
this.sampleClas s = new SampleClass();
this.sampleClas s.SetExampleInt erface(new
ExampleImpl<Str ing>());
}
}
// end C# example
</pre>
So, in the C# example, if I'm forced to store the instance of
<pre>ExampleInt erface</prewith its generic type, then
<pre>SampleClas s</prewill have to be defined as a Generic class, and
stored in SampleBuilder with its generic type, which will then force
<pre>SampleClas s</preto also be defined as a Generic class, and so
on and so forth.
Is there any way to do what I'd like, or am I forced to abandon the
use of Generics completely in C#?
Thanks in advance!
Respectfully,
Robert Kausch

Maybe:

public interface ExampleInterfac eNG {}

public interface ExampleInterfac e<T: ExampleInterfac eNG {}

public class SampleClass
{
private ExampleInterfac eNG exampleInterfac e;

public void SetExampleInter face(ExampleInt erfaceNG
exampleInterfac e)
{
this.exampleInt erface = exampleInterfac e;
}

}

--
Ludwighttp://www.coders-lab.be
Ludwig-

I've explored this a bit, and ran into some problems with how I'm
using the objects..

basically:
public interface Sample
{
void save(Object object);
}

public interface Sample<Type>
{
void save(Type object);
}

public class Example
{
private Sample mSample;

public Example()
{
mSample = new Sample<String>( ); // I realize you can't
instantiate an interface
// pseudo-
code to prevent more typing
}
}
May 17 '07 #5
On May 17, 1:10 pm, "rkau...@gmail. com" <rkau...@gmail. comwrote:
<snip>

Perhaps a good followup question to this issue is: Do C# Generics
support wildcards?

For example, in Java, I can say
private List<?foo;

which will ensure the type safety of the underlying list, I believe.
There's other syntactic sugar that derives from this:
private List<? extends Numberfoo;
private List<? implements Closablebar;
// etc...

I saw the deal about limiting Generics when declaring the type,
basically:
public class Foo<T: where T extends Number
{
// etc,

can you do this on an individual field?

Thanks again!
Robert
May 17 '07 #6
rk*****@gmail.c om <rk*****@gmail. comwrote:
Thanks for the quick reply. If I recall correctly, since Java uses
generics in such a way as to not break the legacy JVMs, it basically
replaces all instances of "T" with the actual type at compile time,
and effectively retains the type safety at run time (you'll get a
class cast exception if you try to put something other than type T
into the object, for example).
No - it replaces all instances of "T" with java.lang.Objec t in the
generic type, and puts runtime casts in the calling code. Here's an
example:

import java.io.*;
import java.util.*;

public class Test
{
public static void main (String[] args)
{
ArrayList<Strin gstrings = new ArrayList<Strin g>();
strings.add("He llo");

Object foo = strings;

ArrayList<Filef iles = (ArrayList<File >) foo;

System.out.prin tln ("Got past the cast");

File x = files.get(0);
}
}

You'll get a warning at compile time, but it *will* compile. It will
then fail later than you really want.
I realize that C# generics are not
implemented this way, which is the crux of the situation. Basically,
I suppose I'm asking for the impossible: the type safety of generics
to be preserved, regardless of how the pointer to the object is being
used (this probably would work in C++ using templates, since n classes
are generated, one for each variation of type T used).
But my point is that the object couldn't be particularly usefully used
any more, because you no longer (at compile-time) have any information
about the original type arguments.

Now, you could make your type implement a non-generic interface if you
don't need to expose the type parameters in the API, but if you want to
keep a strongly typed API, you need the type parameters.
Does the
underlying object preserve the type information after it's created, or
is that always handled by the syntax of the declaration (e.g.
List<Stringalwa ys knows that it can only take a String because the
syntax says <String>, not because the List object preserved String
internally)?
No, a List<stringpres erves its type. If you try the equivalent to the
above code with C#, you'll get a casting exception when you cast the
list, not when you try to access elements within it.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
May 17 '07 #7
rk*****@gmail.c om <rk*****@gmail. comwrote:
On May 17, 1:10 pm, "rkau...@gmail. com" <rkau...@gmail. comwrote:
<snip>

Perhaps a good followup question to this issue is: Do C# Generics
support wildcards?

For example, in Java, I can say
private List<?foo;
No - that, along with covariance/contravariance, are the things Java
generics *do* have over .NET generics. Other than that, .NET generics
rock very hard compared with Java generics.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
May 17 '07 #8
On May 17, 1:10 pm, "rkau...@gmail. com" <rkau...@gmail. comwrote:
Hello everyone,
I'm writing because I'm frustrated with the implementation of C#'s
generics, and need a workaround. I come from a Java background, and
am currently writing a portion of an application that needs
implementations in both Java and C#. I have the Java side done, and
it works fantastic, and the C# side is nearly there. The problem I'm
running into has to do with the differences in implementations of
Generics between the two languages. I would like to use a class that
is defined with Generics, only without having to declare its type
everywhere.

For example, suppose I'm using an IList, and in one location, I
declare it using a generic type of <String>. Now, in a different
class, I'd like to store that list as a field, but I don't want to
store the type associated with it. If I'm required to store the type
with the field (such as <pre>private IList<Stringfie ldName;</pre>,
then the class in which it is stored will be required to be generic,
and any classes that store instances of it will also need to be
generic, ad infinitum, until all my code is generified all over the
place (which I don't want!). Now, the example presented here is
easily solvable, since the IList interface is declared twice (once in
System.Collecti ons as a non-generic version, and once in
System.Collecti ons.Generic as a generic version).

Here's a code example of the Java equivalent, followed by the
(illegal) desired C# syntax:
<pre>
public interface ExampleInterfac e<Type>
{
// some member methods in here

}

public class ExampleImpl<Typ eimplements ExampleInterfac e<Type>
{
// method implementations here

}

public class SampleClass
{
private ExampleInterfac e mExampleInterfa ce;

public void setExampleInter face(ExampleInt erface
pExampleInterfa ce)
{
mExampleInterfa ce = pExampleInterfa ce;
}

}

public class SampleBuilder
{
private SampleClass mSampleClass;

public SampleBuilder()
{
mSampleClass = new SampleClass();
mSampleClass.se tExampleInterfa ce(new ExampleImpl<Str ing>());
}

}

// end Java example
</pre>

Desired C# implementation:
<pre>
public interface ExampleInterfac e<Type>
{
// some member methods in here

}

public class ExampleImpl<Typ e: ExampleInterfac e<Type>
{
// method implementations here

}

public class SampleClass
{
private ExampleInterfac e exampleInterfac e;

public void SetExampleInter face(ExampleInt erface exampleInterfac e)
{
this.exampleInt erface = exampleInterfac e;
}

}

public class SampleBuilder
{
private SampleClass sampleClass;

public SampleBuilder()
{
this.sampleClas s = new SampleClass();
this.sampleClas s.SetExampleInt erface(new
ExampleImpl<Str ing>());
}

}

// end C# example
</pre>

So, in the C# example, if I'm forced to store the instance of
<pre>ExampleInt erface</prewith its generic type, then
<pre>SampleClas s</prewill have to be defined as a Generic class, and
stored in SampleBuilder with its generic type, which will then force
<pre>SampleClas s</preto also be defined as a Generic class, and so
on and so forth.

Is there any way to do what I'd like, or am I forced to abandon the
use of Generics completely in C#?
So, here's another example that might shed some light here... I
unfortunately can't get too specific (proprietary company reasons ;)

basically, imagine you have a database accessor thingy, and you want
that thingy to access rows and columns.
nope
You have written a class to access individual columns, as an object
(call it Column.cs)
Column.cs contains an accessor, and that accessor is Generic in Java
(though stored without being generic), and all data is read from that
accessor
though, in C#, the language forces you into storing the accessor with
its type.
Which means to get the type, you now need to declare Column as a
generic class (Column<Type>)
now, since row must have all of those columns stored in it, it must
now use generics as well
because you can't do List<Columnas a storage object
you'd have to do List<Column<Str ing>>, List<Column<Int 32>>, etc, one
for each different datatype you have.
that's a good analogy, I'm going to post that, see if it gets any more
responses...
Jason: good analogy, but I don't think thats right
as far as doing it in C#
Jason is typing...

Basically, imagine you have a database accessor class, and you want
that class to access rows and columns.
You have written a class to access individual columns, as an object
(call it Column.cs)

Column.cs contains an accessor, and that accessor is Generic in Java
(though stored without being generic), and all data is read from that
accessor. Though, in C#, the language forces you into storing the
accessor with its type.

Which means to get the type, you now need to declare Column as a
generic class (Column<Type>).

Now, since row must have all of those columns stored in it, it must
now use generics as well, because you can't do List<Columnas a
storage object, you'd have to do List<Column<Str ing>>,
List<Column<Int 32>>, etc, one for each different datatype you have.

Thanks again!
Robert

May 17 '07 #9
On May 17, 2:39 pm, Jon Skeet [C# MVP] <s...@pobox.com wrote:
<snip>
A further refined example of the type of problem I'm dealing with,
though I can't get too specific for company proprietary reasons ;):

Basically, imagine you have a database accessor Class, and you want
that Class to access rows and columns.

You have written a class to access individual columns, as an object
(call it Column.cs)

Column.cs contains an accessor, and that accessor is Generic in Java
(though stored without being generic), and all data is read from that
accessor

In C#, the language forces you into storing the accessor with its
type. Which means to get the type, you now need to declare Column as
a generic class (Column<Type>)

Now, since row must have all of those columns stored in it, it must
now use generics as well
because you can't do List<Columnas a storage object you'd have to do
List<Column<Str ing>>, List<Column<Int 32>>, etc, one for each different
datatype you have.

Thanks again!
Robert
May 17 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

49
2887
by: Steven Bethard | last post by:
I promised I'd put together a PEP for a 'generic object' data type for Python 2.5 that allows one to replace __getitem__ style access with dotted-attribute style access (without declaring another class). Any comments would be appreciated! Thanks! Steve ----------------------------------------------------------------------
17
3320
by: Andreas Huber | last post by:
What follows is a discussion of my experience with .NET generics & the ..NET framework (as implemented in the Visual Studio 2005 Beta 1), which leads to questions as to why certain things are the way they are. ***** Summary & Questions ***** In a nutshell, the current .NET generics & .NET framework make it sometimes difficult or even impossible to write truly generic code. For example, it seems to be impossible to write a truly generic
10
2316
by: steve bull | last post by:
I have a class SwatchPanel which takes Swatch as a parameter type. How can I call a static function within the Swatch class? For example the code below fails on TSwatch.Exists. How can I get the call to work? Exists is a method within the Swatch class NOT the SwatchPanel class. Is this possible? Suggestions would be very welcome.
9
12844
by: mps | last post by:
I want to define a class that has a generic parameter that is itself a generic class. For example, if I have a generic IQueue<Tinterface, and class A wants to make use of a generic class that implements IQueue<Tfor all types T (so it can make use of queues of various object types internally). As useful as this is, it doesn't seem possible. The natural (but illegal) notation would be something like class A<QueueClasswhere QueueClass :...
1
3430
by: interX | last post by:
Hi I'm new in VC++ and have a question to generics. I have a generic class, which contains an array of the generic type. This array I can pin and then I would like to get an unmanaged pointer to it. Therefore I wanted to creat a class member which represents the pointer to the array. Unfortunately I get the folowring compile error for the code beneath: error C3229: 'DataType *' : indirections on a generic type parameter
9
5849
by: Steve Richter | last post by:
in a generic class, can I code the class so that I can call a static method of the generic class T? In the ConvertFrom method of the generic TypeConvert class I want to write, I have a call to the static Parse method of the conversion class. if (InValue is string) return T.Parse((string)InValue); else return base.ConvertFrom(context, culture, InValue);
10
1936
by: Egghead | last post by:
Hi all, Can someone kindly enough point me to some situations that we shall or "must" use Generic Class? I can foresee the Generic Method is powerful, but I can not find a single situation that I will need the Generic Class, given there are so many other options. -- cheers,
10
2710
by: phancey | last post by:
I'm quite new to generics. I have 2 generic classes: MyClass<Tand MyOtherClass<T>. MyClass<Thas 2 public Add methods Add(MyOtherClass<T>); Add(MyOtherClass<Wrapper<T>>); (Wrapper<Tis another class that contains an object of type T) I have a third generic class: MyHandler<Twhich contains 2 Add methods and a generic method: Add(T obj)
11
2547
by: Scott Stark | last post by:
Hello, The code below represents a singly-linked list that accepts any type of object. You can see I'm represting the Data variable a System.Object. How would I update this code to use generics instead of System.Object. I want the code in Form1_Load to remain exactly the same, but in the background I want to use generics. I'm trying to get a better understanding of how it works and I'm a little stuck.
0
8913
marktang
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...
0
8761
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,...
0
9280
jinu1996
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...
0
8144
agi2029
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...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
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
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2162
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.