Click here to Skip to main content
15,890,741 members
Home / Discussions / C#
   

C#

 
SuggestionRe: What's The Best Way To Do This? Pin
Sascha Lefèvre1-Nov-17 2:01
professionalSascha Lefèvre1-Nov-17 2:01 
GeneralRe: What's The Best Way To Do This? Pin
Nathan Minier1-Nov-17 2:34
professionalNathan Minier1-Nov-17 2:34 
QuestionRe: What's The Best Way To Do This? Pin
Eddy Vluggen1-Nov-17 10:19
professionalEddy Vluggen1-Nov-17 10:19 
AnswerRe: What's The Best Way To Do This? Pin
Wendelius1-Nov-17 10:51
mentorWendelius1-Nov-17 10:51 
QuestionNext generics Problem Pin
Kevin Marois31-Oct-17 6:03
professionalKevin Marois31-Oct-17 6:03 
AnswerRe: Next generics Problem Pin
harold aptroot31-Oct-17 6:11
harold aptroot31-Oct-17 6:11 
GeneralRe: Next generics Problem Pin
Kevin Marois31-Oct-17 6:25
professionalKevin Marois31-Oct-17 6:25 
QuestionHow To Make This Generic Pin
Kevin Marois31-Oct-17 5:02
professionalKevin Marois31-Oct-17 5:02 
I'm trying to create a generic abstract class:

The base class:
public abstract class DotNetlTypeConverterBase<T>
{
    private List<DataType<T>> _dataTypes;
    public List<DataType<T>> DataTypes
    {
        get { return _dataTypes; }
        private set { _dataTypes = value; }
    }

    public DotNetlTypeConverterBase()
    {
        DataTypes = new List<DataType<T>>();
        Load();
    }

    protected abstract void Load();

    public class DataType<T>
    {
        public DotNetTypes DotNetType { get; private set; }
        public T ConvestionType { get; private set; }

        public DataType(DotNetTypes dotNetType, T convestionType)
        {
            DotNetType = dotNetType;
            ConvestionType = convestionType;
        }
    }
}
A subclass:
public class DotNetToSqlTypeConverter<SqlDbType> : DotNetlTypeConverterBase<SqlDbType>
{
    protected override void Load()
    {
        DataTypes.Add(new DataType<SqlDbType>(DotNetTypes.Short, SqlDbType.SmallInt));
        DataTypes.Add(new DataType<SqlDbType>(DotNetTypes.Double, SqlDbType.Double));
    }
}
In the subclass I get a compile error on second param to the ctor of DataType. The word "SqlDbType" is erroring, yet that's the type I've specified.

The error is "'SqlDbType' is a type parameter, which is not valid in the given context"

What am i doing wrong here?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 31-Oct-17 11:24am.

AnswerRe: How To Make This Generic Pin
Sascha Lefèvre31-Oct-17 5:43
professionalSascha Lefèvre31-Oct-17 5:43 
GeneralRe: How To Make This Generic Pin
Kevin Marois31-Oct-17 5:55
professionalKevin Marois31-Oct-17 5:55 
QuestionWPF assembly in C# Pin
Benjamin Bruno30-Oct-17 19:36
Benjamin Bruno30-Oct-17 19:36 
AnswerRe: WPF assembly in C# Pin
Mycroft Holmes30-Oct-17 20:30
professionalMycroft Holmes30-Oct-17 20:30 
AnswerRe: WPF assembly in C# Pin
Pete O'Hanlon30-Oct-17 20:31
mvePete O'Hanlon30-Oct-17 20:31 
AnswerRe: WPF assembly in C# Pin
OriginalGriff30-Oct-17 20:37
mveOriginalGriff30-Oct-17 20:37 
AnswerRe: WPF assembly in C# Pin
Gerry Schmitz31-Oct-17 12:17
mveGerry Schmitz31-Oct-17 12:17 
GeneralRe: WPF assembly in C# Pin
peterkmx2-Nov-17 6:29
professionalpeterkmx2-Nov-17 6:29 
QuestionEnum of C# Data Types - byte[] and char[] Pin
Kevin Marois30-Oct-17 12:30
professionalKevin Marois30-Oct-17 12:30 
GeneralRe: Enum of C# Data Types - byte[] and char[] Pin
Sascha Lefèvre30-Oct-17 14:06
professionalSascha Lefèvre30-Oct-17 14:06 
GeneralRe: Enum of C# Data Types - byte[] and char[] Pin
Kevin Marois31-Oct-17 4:56
professionalKevin Marois31-Oct-17 4:56 
GeneralRe: Enum of C# Data Types - byte[] and char[] Pin
Sascha Lefèvre31-Oct-17 5:20
professionalSascha Lefèvre31-Oct-17 5:20 
QuestionConvert an obsolete old REST documentation Pin
Member 1096750730-Oct-17 0:54
Member 1096750730-Oct-17 0:54 
QuestionHow calculate Checksum for barcode code128 auto? Pin
Le@rner29-Oct-17 20:01
Le@rner29-Oct-17 20:01 
AnswerRe: How calculate Checksum for barcode code128 auto? Pin
Richard MacCutchan29-Oct-17 22:27
mveRichard MacCutchan29-Oct-17 22:27 
AnswerRe: How calculate Checksum for barcode code128 auto? Pin
Sascha Lefèvre29-Oct-17 22:27
professionalSascha Lefèvre29-Oct-17 22:27 
QuestionNo overload for method, error in c# file for Unity. Pin
Member 1349123628-Oct-17 14:33
Member 1349123628-Oct-17 14:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.