Declaring object type list in class file giving "missing a using directive or assembly reference” error











up vote
0
down vote

favorite












I am getting the titled error when I declare a list with object type in a class file in my Asp.Net web application. I have other classes running so the class system does work. The same declaration is fine in a webform c# code behind. Any help is appreciated.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;

/// <summary>
/// Summary description for TriviaUtilities
/// </summary>
public class TriviaClass
{
public TriviaClass()
{
//
// TODO: Add constructor logic here
//
}

public void getRegistration()
{
List<Activity> sampleREG = new List<Activity>();
}
}


UPDATE: Declaring List<int> sampleREG = new List<int>() or List<string> sampleREG = new List<string>() in the class file poses no problem and this works in a webform also as expected. Declaring the type as an object gives the namespace error in the class file but in the webform it is fine. Since it works on the webform and I have the same namespaces in both the webform and class files, I am suspecting that fixing this is complicated and it needs someone with a higher scope of programming to help with it.










share|improve this question
























  • This doesn’t really help. What’s the full text of the error?
    – stuartd
    Nov 21 at 22:45










  • Maybe you missed including the namespace for your Activity class
    – Quergo
    Nov 21 at 22:46










  • Maybe you need to include any usings for custom classes created within your project
    – Captain Wibble
    Nov 21 at 22:47










  • If the Activity class is defined like this TriviaClass class, then it's in the global namespace. That means it would have to be referenced like global::Activity. But the better solution in that case would be to put your classes inside of a namespace.
    – Rainbolt
    Nov 21 at 22:49










  • @stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
    – matt2605
    Nov 21 at 23:25















up vote
0
down vote

favorite












I am getting the titled error when I declare a list with object type in a class file in my Asp.Net web application. I have other classes running so the class system does work. The same declaration is fine in a webform c# code behind. Any help is appreciated.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;

/// <summary>
/// Summary description for TriviaUtilities
/// </summary>
public class TriviaClass
{
public TriviaClass()
{
//
// TODO: Add constructor logic here
//
}

public void getRegistration()
{
List<Activity> sampleREG = new List<Activity>();
}
}


UPDATE: Declaring List<int> sampleREG = new List<int>() or List<string> sampleREG = new List<string>() in the class file poses no problem and this works in a webform also as expected. Declaring the type as an object gives the namespace error in the class file but in the webform it is fine. Since it works on the webform and I have the same namespaces in both the webform and class files, I am suspecting that fixing this is complicated and it needs someone with a higher scope of programming to help with it.










share|improve this question
























  • This doesn’t really help. What’s the full text of the error?
    – stuartd
    Nov 21 at 22:45










  • Maybe you missed including the namespace for your Activity class
    – Quergo
    Nov 21 at 22:46










  • Maybe you need to include any usings for custom classes created within your project
    – Captain Wibble
    Nov 21 at 22:47










  • If the Activity class is defined like this TriviaClass class, then it's in the global namespace. That means it would have to be referenced like global::Activity. But the better solution in that case would be to put your classes inside of a namespace.
    – Rainbolt
    Nov 21 at 22:49










  • @stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
    – matt2605
    Nov 21 at 23:25













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am getting the titled error when I declare a list with object type in a class file in my Asp.Net web application. I have other classes running so the class system does work. The same declaration is fine in a webform c# code behind. Any help is appreciated.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;

/// <summary>
/// Summary description for TriviaUtilities
/// </summary>
public class TriviaClass
{
public TriviaClass()
{
//
// TODO: Add constructor logic here
//
}

public void getRegistration()
{
List<Activity> sampleREG = new List<Activity>();
}
}


UPDATE: Declaring List<int> sampleREG = new List<int>() or List<string> sampleREG = new List<string>() in the class file poses no problem and this works in a webform also as expected. Declaring the type as an object gives the namespace error in the class file but in the webform it is fine. Since it works on the webform and I have the same namespaces in both the webform and class files, I am suspecting that fixing this is complicated and it needs someone with a higher scope of programming to help with it.










share|improve this question















I am getting the titled error when I declare a list with object type in a class file in my Asp.Net web application. I have other classes running so the class system does work. The same declaration is fine in a webform c# code behind. Any help is appreciated.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;

/// <summary>
/// Summary description for TriviaUtilities
/// </summary>
public class TriviaClass
{
public TriviaClass()
{
//
// TODO: Add constructor logic here
//
}

public void getRegistration()
{
List<Activity> sampleREG = new List<Activity>();
}
}


UPDATE: Declaring List<int> sampleREG = new List<int>() or List<string> sampleREG = new List<string>() in the class file poses no problem and this works in a webform also as expected. Declaring the type as an object gives the namespace error in the class file but in the webform it is fine. Since it works on the webform and I have the same namespaces in both the webform and class files, I am suspecting that fixing this is complicated and it needs someone with a higher scope of programming to help with it.







c# asp.net list class object






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 0:06

























asked Nov 21 at 22:42









matt2605

105113




105113












  • This doesn’t really help. What’s the full text of the error?
    – stuartd
    Nov 21 at 22:45










  • Maybe you missed including the namespace for your Activity class
    – Quergo
    Nov 21 at 22:46










  • Maybe you need to include any usings for custom classes created within your project
    – Captain Wibble
    Nov 21 at 22:47










  • If the Activity class is defined like this TriviaClass class, then it's in the global namespace. That means it would have to be referenced like global::Activity. But the better solution in that case would be to put your classes inside of a namespace.
    – Rainbolt
    Nov 21 at 22:49










  • @stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
    – matt2605
    Nov 21 at 23:25


















  • This doesn’t really help. What’s the full text of the error?
    – stuartd
    Nov 21 at 22:45










  • Maybe you missed including the namespace for your Activity class
    – Quergo
    Nov 21 at 22:46










  • Maybe you need to include any usings for custom classes created within your project
    – Captain Wibble
    Nov 21 at 22:47










  • If the Activity class is defined like this TriviaClass class, then it's in the global namespace. That means it would have to be referenced like global::Activity. But the better solution in that case would be to put your classes inside of a namespace.
    – Rainbolt
    Nov 21 at 22:49










  • @stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
    – matt2605
    Nov 21 at 23:25
















This doesn’t really help. What’s the full text of the error?
– stuartd
Nov 21 at 22:45




This doesn’t really help. What’s the full text of the error?
– stuartd
Nov 21 at 22:45












Maybe you missed including the namespace for your Activity class
– Quergo
Nov 21 at 22:46




Maybe you missed including the namespace for your Activity class
– Quergo
Nov 21 at 22:46












Maybe you need to include any usings for custom classes created within your project
– Captain Wibble
Nov 21 at 22:47




Maybe you need to include any usings for custom classes created within your project
– Captain Wibble
Nov 21 at 22:47












If the Activity class is defined like this TriviaClass class, then it's in the global namespace. That means it would have to be referenced like global::Activity. But the better solution in that case would be to put your classes inside of a namespace.
– Rainbolt
Nov 21 at 22:49




If the Activity class is defined like this TriviaClass class, then it's in the global namespace. That means it would have to be referenced like global::Activity. But the better solution in that case would be to put your classes inside of a namespace.
– Rainbolt
Nov 21 at 22:49












@stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
– matt2605
Nov 21 at 23:25




@stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
– matt2605
Nov 21 at 23:25












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
See here to create a class.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421447%2fdeclaring-object-type-list-in-class-file-giving-missing-a-using-directive-or-as%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
    See here to create a class.






    share|improve this answer

























      up vote
      0
      down vote













      Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
      See here to create a class.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
        See here to create a class.






        share|improve this answer












        Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
        See here to create a class.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 at 8:43









        matt2605

        105113




        105113






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421447%2fdeclaring-object-type-list-in-class-file-giving-missing-a-using-directive-or-as%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            What visual should I use to simply compare current year value vs last year in Power BI desktop

            Alexandru Averescu

            Trompette piccolo