24 Topics
|
|
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 … |
|
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 … |
|
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 … |
|
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. … |
|
# 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 … |
|
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 … |
|
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 … |
|
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). … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 = … |
|
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) … |
|
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 . … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
The End.