Click here to Skip to main content
15,906,094 members
Home / Discussions / C#
   

C#

 
GeneralRe: string Pin
Richard MacCutchan11-Apr-18 1:44
mveRichard MacCutchan11-Apr-18 1:44 
GeneralRe: string Pin
OriginalGriff11-Apr-18 1:51
mveOriginalGriff11-Apr-18 1:51 
QuestionC# Integrating With Skype Pin
Gavin Coates10-Apr-18 9:45
Gavin Coates10-Apr-18 9:45 
AnswerRe: C# Integrating With Skype Pin
Richard MacCutchan10-Apr-18 11:08
mveRichard MacCutchan10-Apr-18 11:08 
GeneralRe: C# Integrating With Skype Pin
Gavin Coates11-Apr-18 3:13
Gavin Coates11-Apr-18 3:13 
AnswerRe: C# Integrating With Skype Pin
Gerry Schmitz10-Apr-18 11:21
mveGerry Schmitz10-Apr-18 11:21 
Questionexcel udf returns only the first column name in order to display a two dimentional array Pin
Gtari Abir10-Apr-18 6:16
Gtari Abir10-Apr-18 6:16 
AnswerRe: excel udf returns only the first column name in order to display a two dimentional array Pin
Richard Andrew x6410-Apr-18 6:57
professionalRichard Andrew x6410-Apr-18 6:57 
AnswerRe: excel udf returns only the first column name in order to display a two dimentional array Pin
Luc Pattyn10-Apr-18 13:03
sitebuilderLuc Pattyn10-Apr-18 13:03 
GeneralRe: excel udf returns only the first column name in order to display a two dimentional array Pin
Gtari Abir12-Apr-18 0:13
Gtari Abir12-Apr-18 0:13 
GeneralRe: excel udf returns only the first column name in order to display a two dimentional array Pin
Luc Pattyn12-Apr-18 3:09
sitebuilderLuc Pattyn12-Apr-18 3:09 
QuestionIssues in ajax call in MVC Pin
Dhyanga9-Apr-18 5:41
Dhyanga9-Apr-18 5:41 
AnswerRe: Issues in ajax call in MVC Pin
Dhyanga9-Apr-18 6:50
Dhyanga9-Apr-18 6:50 
QuestionSyntax of creating the following matrix in C# Pin
Shibe19959-Apr-18 1:00
Shibe19959-Apr-18 1:00 
AnswerRe: Syntax of creating the following matrix in C# Pin
Gerry Schmitz9-Apr-18 2:27
mveGerry Schmitz9-Apr-18 2:27 
AnswerRe: Syntax of creating the following matrix in C# Pin
Dave Kreskowiak9-Apr-18 4:28
mveDave Kreskowiak9-Apr-18 4:28 
AnswerRe: Syntax of creating the following matrix in C# Pin
BillWoodruff11-Apr-18 8:26
professionalBillWoodruff11-Apr-18 8:26 
Questiongeneric type with value parameter rather than type parameter Pin
Alexander Kindel7-Apr-18 11:19
Alexander Kindel7-Apr-18 11:19 
AnswerRe: generic type with value parameter rather than type parameter Pin
OriginalGriff7-Apr-18 23:27
mveOriginalGriff7-Apr-18 23:27 
GeneralRe: generic type with value parameter rather than type parameter Pin
Alexander Kindel8-Apr-18 0:46
Alexander Kindel8-Apr-18 0:46 
GeneralRe: generic type with value parameter rather than type parameter Pin
OriginalGriff8-Apr-18 1:15
mveOriginalGriff8-Apr-18 1:15 
AnswerRe: generic type with value parameter rather than type parameter Pin
BillWoodruff8-Apr-18 3:39
professionalBillWoodruff8-Apr-18 3:39 
My first thought was of using an Enum, keeping in mind that an Enum can have values that are not explicitly named: i.e.:
public enum PolyCharacteristicValue : Int32
{
    NoCharacteristic = -1
}

public class Poly
{
    public Poly(Int32 characteristic)
    {
        Characteristic = (PolyCharacteristicValue) characteristic;
    }

    public Poly(PolyCharacteristicValue characteristic)
    {
        Characteristic = characteristic;
    }

    public PolyCharacteristicValue Characteristic { set; get; }

}

// usage example .. in some method:
Poly polyNoChar = new Poly(-1);
Poly polyT0 = new Poly(0);
Poly polyT99 = new Poly(99);
Sketch: Then in some extension method:
public static class PolyExtensions
{
    public static Poly PolyAdd(this Poly p1, Poly p2)
    {
        if (p1.Characteristic != p2.Characteristic)
        {
            throw new InvalidEnumArgumentException();
        }

        Poly newPoly = new Poly(p1.Characteristic);

        if (p1.Characteristic == PolyCharacteristicValue.NoCharacteristic)
        {
            // process
            return newPoly;
        }

        // process
        return newPoly;
    }
}
The second idea would be to use a nullable Int in much the same way.

Would having the ability to compare two Polys, and do something if one of them's Enum value was greater, or lesser, than the other's be of any use ?

I am unclear if there's a relationship between the possible number of integer terms in the Polynomial and what is shown here as an Enum.
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12


modified 8-Apr-18 11:07am.

AnswerRe: generic type with value parameter rather than type parameter Pin
#realJSOP8-Apr-18 5:36
professional#realJSOP8-Apr-18 5:36 
GeneralRe: generic type with value parameter rather than type parameter Pin
Alexander Kindel8-Apr-18 11:30
Alexander Kindel8-Apr-18 11:30 
AnswerRe: generic type with value parameter rather than type parameter Pin
Gerry Schmitz8-Apr-18 6:54
mveGerry Schmitz8-Apr-18 6:54 

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.