<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tag 'generics'</title><link>http://forums.asp.net/search/SearchResults.aspx?q=&amp;tag=generics&amp;orTags=0&amp;o=DateDescending</link><description>Search results matching tag 'generics'</description><dc:language>en-US</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Duplicates</title><link>http://forums.asp.net/thread/3564439.aspx</link><pubDate>Mon, 14 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3564439</guid><dc:creator>davidl</dc:creator><description>&lt;p&gt;I have the following snippet of code:&lt;/p&gt;
&lt;p&gt;Public MyCollection As New List(Of String)&lt;/p&gt;
&lt;p&gt;Private Function GetFiles(ByVal strPath As String, ByVal searchList As List(Of String)) As List(Of String)&lt;br /&gt;Dim matches As New List(Of String)&lt;br /&gt;For Each pattern As String In searchList&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; matches.AddRange(System.IO.Directory.GetFiles(strPath, pattern))&lt;br /&gt;Next&lt;br /&gt;Return matches&lt;br /&gt;End Function&lt;/p&gt;
&lt;p&gt;Private Sub GetMyFiles(ByVal strPath As String)&lt;br /&gt;Dim SupportedFormats As New List(Of String)&lt;br /&gt;With SupportedFormats&lt;br /&gt;.Add(&amp;quot;*.txt&amp;quot;)&lt;br /&gt;.Add(&amp;quot;*.doc&amp;quot;)&lt;br /&gt;End With&lt;/p&gt;
&lt;p&gt;MyCollection.AddRange(Module1.GetFiles(strPath, SupportedFormats))&lt;/p&gt;
&lt;p&gt;Dim DI As New System.IO.DirectoryInfo(strPath)&lt;/p&gt;
&lt;p&gt;For Each d As System.IO.DirectoryInfo In DI.GetDirectories&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Writeline(d.Fullname)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Module1.GetMyFiles(d.FullName)&lt;br /&gt;Next d&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Can someone&amp;nbsp;please tell me why I&amp;nbsp;am getting some duplicate entries and how to fix it?&amp;nbsp;The Console.Writeline(d.Fullname) is showing the correct directory structure with no duplicates, but if you iterate through&amp;nbsp;MyCollection there are duplicates.&amp;nbsp; Please help. :)&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>problem with generics</title><link>http://forums.asp.net/thread/3403604.aspx</link><pubDate>Mon, 14 Sep 2009 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3403604</guid><dc:creator>sansat6699</dc:creator><description>&lt;p&gt;i am having&lt;/p&gt;&lt;p&gt;public&amp;nbsp; class studentCollection:Collection &amp;lt;studentCollection&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //constructer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public studentCollection(): base(new List&amp;lt;student&amp;gt;())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;gives me error&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;1 Error&amp;nbsp;&amp;nbsp; &amp;nbsp;3&amp;nbsp;&amp;nbsp; &amp;nbsp;The best overloaded method match for &amp;#39;System.Collections.ObjectModel.Collection&amp;lt;C.Bl.studentCollection&amp;gt;.Collection(System.Collections.Generic.IList&amp;lt;C.Bl.studentCollection&amp;gt;)&amp;#39; has some invalid arguments&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;2 Error&amp;nbsp;&amp;nbsp; &amp;nbsp;4&amp;nbsp;&amp;nbsp; &amp;nbsp;Argument &amp;#39;1&amp;#39;: cannot convert from &amp;#39;System.Collections.Generic.List&amp;lt;C.Bl.student&amp;gt;&amp;#39; to &amp;#39;System.Collections.Generic.IList&amp;lt;C.Bl.studentCollection&amp;gt;&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Inheritance using generics</title><link>http://forums.asp.net/thread/3383140.aspx</link><pubDate>Wed, 02 Sep 2009 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3383140</guid><dc:creator>deswillans</dc:creator><description>&lt;p&gt;I have had a good old Google to try and solve this problem and havn&amp;#39;t managed it yet.&amp;nbsp; Basically I am stuck with a compiler error saying:&lt;/p&gt;&lt;p&gt;&lt;i&gt; Error&amp;nbsp;&amp;nbsp; &amp;nbsp;1&amp;nbsp;&amp;nbsp; &amp;nbsp;Cannot implicitly convert type &amp;#39;ClassLibrary1.MeerKatCollection&amp;lt;ClassLibrary1.MeerKat&amp;gt;&amp;#39; to &amp;#39;ClassLibrary1.MongooseCollection&amp;lt;ClassLibrary1.Mongoose&amp;gt;&amp;#39;&amp;nbsp;&amp;nbsp; &amp;nbsp;ClassLibrary1&amp;nbsp;&amp;nbsp; &amp;nbsp;C:\My Projects\Throw aways\ClassLibrary1\Class1.cs&amp;nbsp;&amp;nbsp; &amp;nbsp;50&amp;nbsp;&amp;nbsp; &amp;nbsp;17&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Below is some sample code that replicates what I am trying to achieve but can&amp;#39;t.&amp;nbsp; Please ignore the fact that the Collection classes do not implement IList or ICollection or similar.&amp;nbsp; I am hoping that that is not a show stopper.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="c-sharp"&gt;public abstract class Mongoose
	{
	}

	public class MeerKat : Mongoose
	{
	}

	public abstract class MongooseCollection&amp;lt;T&amp;gt; where T : Mongoose
	{
		private List&amp;lt;T&amp;gt; _mongeese = new List&amp;lt;T&amp;gt;();

		public abstract void Feed(T animal);

		public void LookAfter()
		{
			// some common logic to apply to all collections of mongeese
			foreach (T mongoose in _mongeese)
			{
				Feed(mongoose);
			}
		}
	}

	public class MeerKatCollection&amp;lt;T&amp;gt; : MongooseCollection&amp;lt;MeerKat&amp;gt; 
	{
		private void UpdateFedMeerkatsInDB()
		{
		}

		public override void Feed(MeerKat meerkat)
		{
			// Do the feeding
			UpdateFedMeerkatsInDB();
		}
	}

	public class Test
	{
		public Test()
		{
			MongooseCollection&amp;lt;Mongoose&amp;gt; collection;
			collection = new MeerKatCollection&amp;lt;MeerKat&amp;gt;();    // This is the line the Compiler is moaning about&lt;br /&gt; 
			collection.LookAfter();	// Call method on base class that in turn uses specific knowledge of
									// domain in the instantiated derived class at runtime
		}
	}&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;My understandong of inheritance is that since all Meerkats are Mongeese I should be able to store a collection of them in the collection field (Defined as MongooseCollection&amp;lt;Mongoose&amp;gt;)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Any thoughts on the matter would be greatly appreciated&lt;br /&gt;&lt;/p&gt;</description></item><item><title>how to convert generic list to list of type string</title><link>http://forums.asp.net/thread/3244561.aspx</link><pubDate>Fri, 19 Jun 2009 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3244561</guid><dc:creator>cmakwana</dc:creator><description>&lt;p&gt;&amp;nbsp;hi,&lt;/p&gt;&lt;p&gt;this is sample code,&lt;/p&gt;&lt;p&gt;&amp;nbsp;public class BackUpLogic&amp;lt;T&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&amp;nbsp; void tableBackup(List&amp;lt;string&amp;gt; columnNames, List&amp;lt;T&amp;gt; tableData)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (string cName in columnNames)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (T tRow in tableData)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;in second foreach ,tRow is holding data of one database table row.&lt;/p&gt;&lt;p&gt;i wan to convert that into string.&lt;/p&gt;&lt;p&gt;i dont know how to do that.&lt;/p&gt;&lt;p&gt;please help me. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Enumerate on Generic List, List&amp;lt;T&amp;gt;</title><link>http://forums.asp.net/thread/3197199.aspx</link><pubDate>Fri, 29 May 2009 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3197199</guid><dc:creator>garmang09</dc:creator><description>&lt;p&gt;&amp;nbsp;I&amp;#39;m trying to use a List&amp;lt;T&amp;gt;.Enumerator on a list of custom objects and the enumerators MoveNext() returns true but Current never gets populated with any item from the list. The foreach works fine but I can&amp;#39;t use that because I need to loop within a WF workflow so I&amp;#39;m forced to use a enumerator. Here is my custom object class it&amp;#39;s pretty basic. Any suggestions would be appreciated.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;b id="1"&gt;1    &lt;/b&gt;&lt;span class="kwd"&gt;public class&lt;/span&gt; Approval
&lt;b id="2"&gt;2    &lt;/b&gt;    {
&lt;b id="3"&gt;3    &lt;/b&gt;        &lt;span class="kwd"&gt;private int&lt;/span&gt; _objectId;
&lt;b id="4"&gt;4    &lt;/b&gt;        &lt;span class="kwd"&gt;private int&lt;/span&gt; _objectTypeId;
&lt;b id="5"&gt;5    &lt;/b&gt;
&lt;b id="6"&gt;6    &lt;/b&gt;        &lt;span class="kwd"&gt;public int&lt;/span&gt; ObjectTypeId
&lt;b id="7"&gt;7    &lt;/b&gt;        {
&lt;b id="8"&gt;8    &lt;/b&gt;            &lt;span class="kwd"&gt;get&lt;/span&gt; { &lt;span class="kwd"&gt;return&lt;/span&gt; _objectTypeId; }
&lt;b id="9"&gt;9    &lt;/b&gt;            &lt;span class="kwd"&gt;set&lt;/span&gt; { _objectTypeId = &lt;span class="kwd"&gt;value&lt;/span&gt;; }
&lt;b id="10"&gt;10   &lt;/b&gt;        }
&lt;b id="11"&gt;11   &lt;/b&gt;
&lt;b id="12"&gt;12   &lt;/b&gt;        &lt;span class="kwd"&gt;public int&lt;/span&gt; ObjectId
&lt;b id="13"&gt;13   &lt;/b&gt;        {
&lt;b id="14"&gt;14   &lt;/b&gt;            &lt;span class="kwd"&gt;get&lt;/span&gt; { &lt;span class="kwd"&gt;return&lt;/span&gt; _objectId; }
&lt;b id="15"&gt;15   &lt;/b&gt;            &lt;span class="kwd"&gt;set&lt;/span&gt; { _objectId = &lt;span class="kwd"&gt;value&lt;/span&gt;; }
&lt;b id="16"&gt;16   &lt;/b&gt;        }
&lt;b id="17"&gt;17   &lt;/b&gt;
&lt;b id="18"&gt;18   &lt;/b&gt;        &lt;span class="kwd"&gt;public&lt;/span&gt; Approval(&lt;span class="kwd"&gt;int&lt;/span&gt; objectId, &lt;span class="kwd"&gt;int&lt;/span&gt; objectTypeId)
&lt;b id="19"&gt;19   &lt;/b&gt;        {
&lt;b id="20"&gt;20   &lt;/b&gt;            ObjectId = objectId;
&lt;b id="21"&gt;21   &lt;/b&gt;            ObjectTypeId = objectTypeId;
&lt;b id="22"&gt;22   &lt;/b&gt;        }
&lt;/pre&gt;&amp;nbsp;&amp;nbsp;</description></item><item><title>Deployment project can compile when view is strongly typed to List&amp;lt;string&amp;gt;</title><link>http://forums.asp.net/thread/2949751.aspx</link><pubDate>Wed, 18 Feb 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2949751</guid><dc:creator>random0xff</dc:creator><description>&lt;p&gt;I need to deploy an ASP.NET MVC project, and I use the web deployment projects to do so. The app compiles and runs fine, but the deployment project has a problem with a strongly typed view in the project. it is of type System.Web.Mvc.ViewPage&amp;lt;List&amp;lt;string&amp;gt;&amp;gt; and the error message is:&lt;/p&gt;&lt;p&gt;Could not load type &amp;#39;System.Web.Mvc.ViewPage&amp;lt;List&amp;lt;string&amp;gt;&amp;gt;&amp;#39;.&lt;/p&gt;&lt;p&gt;I don&amp;#39;t really know what to do here. Any help would be appreciated since I rely on the deployment project to go live, and now it&amp;#39;s blocking.&lt;/p&gt;&lt;p&gt;Thanks! &lt;br /&gt;&lt;/p&gt;</description></item><item><title>c# code pasteing</title><link>http://forums.asp.net/thread/2836784.aspx</link><pubDate>Mon, 29 Dec 2008 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2836784</guid><dc:creator>sjnaughton</dc:creator><description>&lt;p&gt;This is just to mention that the c# code paste does not paste in the Generics part of code see this post here &lt;a class="ForumNameUnRead" title="Hello, I want to validate some fields that are decimal and integer&amp;#10; &amp;#10;I wrote this class.&amp;#10; &amp;#10;&amp;#10; [DisplayName(&amp;quot;Areas de Evaluación&amp;quot;)]&amp;#10; public class EvaluationAreaMetaData&amp;#10; {&amp;#10; [ScaffoldColumn(false)]&amp;#10; public object Id { get; set; }&amp;#10;&amp;#10; [Required(ErrorMessage = &amp;quot;Este campo es Requerido&amp;quot;)]&amp;#10; [DisplayName(..." href="http://forums.asp.net/t/1365732.aspx"&gt;&lt;strong&gt;&lt;font color="#034efa"&gt;Validation shows me the errors in english and not in spanish&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt; compare &lt;a href="http://forums.asp.net/members/davidebb.aspx"&gt;&lt;font color="#034efa"&gt;davidebb&lt;/font&gt;&lt;/a&gt; post and my (&lt;a href="http://forums.asp.net/members/sjnaughton.aspx"&gt;&lt;font color="#034efa"&gt;sjnaughton&lt;/font&gt;&lt;/a&gt;) post and the OfType() method which is missing the &amp;lt;DataTypeAttribute&amp;gt;. I have manually pasted in the missing bite see example below:&amp;nbsp;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;protected void&lt;/span&gt; Page_Load(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, EventArgs e)
{
    TextBox1.ToolTip = Column.Description;

    SetUpValidator(RequiredFieldValidator1);
    SetUpValidator(CompareValidator1);
    SetUpValidator(RegularExpressionValidator1);
    SetUpValidator(RangeValidator1);
    SetUpValidator(DynamicValidator1);

    &lt;span class="cmt"&gt;// fix for CompareValidator not getting custom message&lt;/span&gt;
    var dataType = Column.Attributes.OfType().FirstOrDefault();
    &lt;span class="kwd"&gt;if&lt;/span&gt; (dataType != &lt;span class="kwd"&gt;null&lt;/span&gt;)
        CompareValidator1.ErrorMessage = dataType.ErrorMessage;
}
&lt;/pre&gt;
&lt;p&gt;If you look at the HTML you will see &amp;nbsp;&lt;/p&gt;
&lt;p&gt;var dataType = Column.Attributes.OfType&lt;strong&gt;&lt;em&gt;&amp;lt;DATATYPEATTRIBUTE&amp;gt;&lt;/em&gt;&lt;/strong&gt;().FirstOrDefault();&lt;/p&gt;
&lt;p&gt;Note the section in &lt;strong&gt;&lt;em&gt;BOLD ITALIC&lt;/em&gt;&lt;/strong&gt; this seems to be treated as unkown HTML&lt;/p&gt;</description></item><item><title>Problems with runtime specification of generic type T in User Control</title><link>http://forums.asp.net/thread/2745737.aspx</link><pubDate>Fri, 14 Nov 2008 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2745737</guid><dc:creator>cchamberlain1976</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a web user control that needs&amp;nbsp;to populate itself&amp;nbsp;using a generic object. The type of that generic object will need to be passed into the user control&amp;nbsp;using a parameter.&lt;/p&gt;
&lt;p&gt;The code I have tried is as follows, but the compiler fails stating: the type arguments for method&amp;nbsp;&amp;#39;GetQuestion&amp;lt;T&amp;gt;(&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;GenericQuestion&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;&amp;lt;T&amp;gt; Question)&lt;/font&gt;&lt;/font&gt;&amp;#39; cannot be inferred from the usage. Try specifying the type arguments. Any help would be greatly appreciated. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;Regards&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Chris Chamberlain&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;public&lt;/span&gt; partial &lt;span class="kwd"&gt;class&lt;/span&gt; Controls_GenericQuestion : System.Web.UI.UserControl
{
&lt;span class="kwd"&gt;private string&lt;/span&gt; _DataType;
&lt;span class="kwd"&gt;private int&lt;/span&gt; _QuestionID = 0;

&lt;span class="kwd"&gt;public int&lt;/span&gt; QuestionID
{
&lt;span class="kwd"&gt;get&lt;/span&gt; { &lt;span class="kwd"&gt;return&lt;/span&gt; _QuestionID; }
&lt;span class="kwd"&gt;set&lt;/span&gt; { _QuestionID = &lt;span class="kwd"&gt;value&lt;/span&gt;; }
}

&lt;span class="kwd"&gt;public&lt;/span&gt; String DataType 
{ 
&lt;span class="kwd"&gt;get&lt;/span&gt; { &lt;span class="kwd"&gt;return&lt;/span&gt; _DataType; } 
&lt;span class="kwd"&gt;set&lt;/span&gt; 
{ 
_DataType = &lt;span class="kwd"&gt;value&lt;/span&gt;;
Type generic = &lt;span class="kwd"&gt;typeof&lt;/span&gt;(GenericQuestion&amp;lt;&amp;gt;);
Type inputType = Type.GetType(_DataType);
Type[] typeArgs = { inputType };
Type genericType = generic.MakeGenericType(typeArgs);
GetQuestion&amp;lt;typeArgs&amp;gt;(Activator.CreateInstance(genericType));
}

&lt;span class="kwd"&gt;public void&lt;/span&gt; GetQuestion&amp;lt;T&amp;gt;(GenericQuestion&amp;lt;T&amp;gt; genQuestion)
{
GenericQuestionMapper&amp;lt;T&amp;gt; mapper = &lt;span class="kwd"&gt;new&lt;/span&gt; GenericQuestionMapper&amp;lt;T&amp;gt;();
genQuestion = mapper.GetInstance(_QuestionID);
&lt;span class="cmt"&gt;/* Population code involving genQuestion */&lt;/span&gt;
}
}&lt;/pre&gt;</description></item><item><title>Generic return type.. help needed</title><link>http://forums.asp.net/thread/2703396.aspx</link><pubDate>Thu, 23 Oct 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2703396</guid><dc:creator>sashee</dc:creator><description>&lt;p&gt;Hi:&lt;/p&gt;
&lt;p&gt;I am trying my hand on generics and I was struck when I prepared a method that returns a generic type. Here is the sample:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private M testmethod&amp;lt;T,M&amp;gt;(IList&amp;lt;T&amp;gt; request)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IDictionary&amp;lt;int, string&amp;gt; dict = new Dictionary&amp;lt;int, string&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (testclass myclass in (IList&amp;lt;testclass&amp;gt;)request)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dict.Add(myclass.testint, myclass.teststr);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return dict;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;And I am calling above method like: &lt;/p&gt;
&lt;p&gt;dict = testmethod&amp;lt;testclass, IDictionary&amp;lt;int, string&amp;gt;&amp;gt;(mylist);&lt;/p&gt;
&lt;p&gt;So I want to pass a list of a particular classes and return a dictionary made of those class values.&lt;/p&gt;
&lt;p&gt;I am sure, I am missing the right syntax somewhere. please help me.. Thanks in advance..&lt;/p&gt;
&lt;p&gt;~sashee&lt;/p&gt;</description></item><item><title>Re: Typed ViewPage Using Generics Without Code Behind</title><link>http://forums.asp.net/thread/2700360.aspx</link><pubDate>Wed, 22 Oct 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2700360</guid><dc:creator>koistya</dc:creator><description>&lt;p&gt;You just have explicitly added Version, Culture and PublicKeyToken to my example though all they are optional as far as I know. Anyway I have also added them and have same issues with Intellisense:&lt;br /&gt;&lt;br /&gt;&lt;img title="ViewsWithoutCodeBehind2.png" style="WIDTH:811px;HEIGHT:222px;" height="222" alt="ViewsWithoutCodeBehind2.png" src="http://navin.biz/files/ViewsWithoutCodeBehind2.png" width="811" /&gt;&lt;/p&gt;</description></item></channel></rss>