24 Topics

Member Avatar for
Member Avatar for ddanbe

I'm referring to my snippet [Inheriting the stack class](https://www.daniweb.com/software-development/csharp/code/498828/inheriting-the-stack-class) After looong loong searches and many tries and tests, I finally came up with a version that works as I wanted to. Stacker can now handle any type of object, even with arethmetic methods in place. The virtual way as proposed …

Member Avatar for JOSheaIV
0
276
Member Avatar for genux008

Hello Everyone, Actually i have one question. I create one generic method like below:- public static dynamic ExecuteSelectProcedure<T>(string procedureName) where T: class { SqlDataReader reader = ExecuteSelectCommand(procedureName, CommandType.StoredProcedure); if (typeof(T).FullName.Equals("System.Data.DataTable")) { DataTable dt = new DataTable(); dt.Load(reader); reader.Close(); return dt; } return reader; } Now i want to restrict user …

Member Avatar for DaveAmour
0
252
Member Avatar for ddanbe

It comes in handy of course that you can dynamically adjust the size of a List or Dictionary. But this time I want to use a Dictionary with sizes from 1 to 8. When I have e.g. size 3, it will stay that way. On the net I found a …

Member Avatar for ddanbe
0
184
Member Avatar for murali2489

Dear All, I am reading Generics, below method is confusing. It clearly mentioned in the Method parameter that it should accept only List. But when i give ArrayList as Argument it compiles. It should be only List right? eventhough Arraylist is an implementaion class. below is the code PLease explain. …

Member Avatar for murali2489
0
231
Member Avatar for mike_2000_17

# Introduction # The subject of this tutorial is a bit more advanced than the subjects I have tackled in the past, but I hope this will find some interested readers. From time to time in C++, programmers find themselves torn apart between using a *Generic Programming* style which primarily …

2
2K
Member Avatar for johnyjj2

Hello, I have a difficulty with changing interface from ordinary one to generic one. Could you suggest me how I can achieve this goal, please? This is the way how I initialize API, based on user's choice from configuration which implementation of interface should be chosen: /// MyServiceApplication.MyServiceApplication.cs GeneralSystemAPI.Initialize(); This …

Member Avatar for johnyjj2
0
209
Member Avatar for kiail

Hello, I have a list that holds transactions. Currently I'm trying to write it to the console and have each transaction numbered with the transaction amount included beside it. I currently have code that produces something like Transaction #1: $400 Transaction #1: $400 Transaction #2: $599.99 Transaction #2: $599.99 How …

Member Avatar for Momerath
0
143
Member Avatar for Krokcy

Hey! Im doing a project, where i have to manage a bunch of different appliences. I´ve made a custom generic collection class that has a few different search methods. Now the collection class has to hold all of the different appliances (so they all inherits from the same superclass: Appliance). …

Member Avatar for Ketsuekiame
0
253
Member Avatar for Pundia

Hello! I'm trying to fill a Crystal Reports in a generic way. This is because I don't have direct access to the database, I just call a service that returns a DataTable. I'm no expert in C# or Crystal Reports, is there any way to fill a Crystal report without …

0
196
Member Avatar for vkvkvk

Hello, I have written a C# class for BinarySearchTree <T> where T is generic type, which creates a binary serach tree, returns true/false if it is empty, gives leftsubtree, rightsubtree, prints nodes. I want to write a search method, int search (T element), which will search the element if it …

Member Avatar for vkvkvk
0
278
Member Avatar for Begginnerdev

Hello my fellow Daniwebers! I am having some problems wrapping my head around the task sorting a List(Of CustomType) I have a list containing a custom class. The class contains Two DateTime objects, Start and End. I am trying to sort the list descending so that the shortest timespan will …

Member Avatar for Begginnerdev
0
439
Member Avatar for tingwong

Hi everyone, I have a project that creates a Train that pulls Boxcars. The boxcar is supposed to be generic type and have attributes such as load that adds only a specific type of object to the boxcar. The train is supposed to pull all boxcars created. I have written …

Member Avatar for JamesCherrill
0
333
Member Avatar for nah094020

Ok guys i have a few questions about implementing a gneric hash table using linear probing. Ok first, i need to make an entry class Entry<K,V> then An Entry <K,V> table array but since its gneric must initiatied elsewhere my question is how does the class entry work , from …

Member Avatar for NormR1
0
2K
Member Avatar for rahul.ch

List<? extends Integer> list = new ArrayList<Integer>(); for (Integer element : list) { System.out.println(element); List<? super Integer> list = new ArrayList<Integer>(); for (Integer element : list) { System.out.println(element); For the first three lines as Case 1 using extends it compiles fine. But for Case 2 of next three lines, it …

Member Avatar for rahul.ch
0
2K
Member Avatar for Jnk

Hello I am a new to C++ and have some questions. I have two classes called Point and Square like this: [CODE] class Point { int x, y; public: int getx() const { return x; } int gety() const { return y; } Point(int a, int b) { x = …

Member Avatar for Jnk
0
452
Member Avatar for skatamatic

I am trying to write a somewhat generic class for calculating rolling averages. It's generic in the sense that it needs to support all numeric datatypes (int, double, short and long). I'm a bit of a noobie to VB.Net and have run into a problem: [code] Public Class RollingAverage(Of T) …

Member Avatar for lolafuertes
0
162
Member Avatar for jeevsmyd

I'm new to generic programming and I just cant figure out what is wrong in this . The program is supposed to make a linked list using class. I have used 2 classes so that a single object of class LL can be used to manipulate a linked list . …

Member Avatar for mike_2000_17
0
131
Member Avatar for arcaolcer

I am developing a project with wcf . I need to develop a wcf service that will take data from database. I should write it in WCF custom data provider. I can do it with wcf linq and webService with EF. But I can not understand the example of Custom …

Member Avatar for arcaolcer
0
242
Member Avatar for barriegrant1

when uploading an image to the website i get the following error message: [CODE] Server Error in '/' Application. A generic error occurred in GDI+. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and …

Member Avatar for barriegrant1
0
2K
Member Avatar for anandunics

Hi All, I am new to XML,XSLT. I have been assigned to task of Generating HTML pages based on the XML file & the condition is No Hardcoding of Nodes and other details. My XML file is of the below struct: Node inside Nodes , and those nodes would contain …

Member Avatar for anandunics
0
1K
Member Avatar for Momerath

The past few days I've posted some sorting routines customized to the tasks they were required to solve. Since I have a bunch of different sorting routines already coded, I decided to post them. Please note that some of these sorts are fast, but not a single one is as …

Member Avatar for Momerath
3
818
Member Avatar for daudiam

Consider the following code : [CODE]class R2<E> { E a; E get() { return a; } void set(E a) { this.a=a; } } class R3 { void doit(R2 a) // (1) { a.set(new Integer(5)); } }[/CODE] When I compile the file containing class R3, it rightly gives an unchecked warning …

Member Avatar for daudiam
0
160
Member Avatar for daudiam

Consider the following code : [CODE]class R2<E> { E a; E get() { return a; } void set(E a) { this.a=a; } public static void main(String aa[]) { R2 nn1=new R2<Integer>(); nn1.set("hello"); (1) //String r=nn1.get(); //Integer t=nn1.get(); } }[/CODE] In line (1), an unchecked warning is given as the compiler …

Member Avatar for daudiam
0
200
Member Avatar for mike_2000_17

Hey y'all, I was just curious about which idiom you prefer or use very often.. and why? Please vote on the poll! I understand that there are a lot of choices but you can vote for multiples, but try to pick only the ones you think are the best, or …

Member Avatar for mrnutty
0
209

The End.