2
Answers

how to implement typedef struct union in C#

Premal Mehta

Premal Mehta

8y
574
1

Hi guys,

I have to rewrite this C++ code in C#. C# does not support typedef or union. How can I do this in C# ?
 
typedef enum {
  TYPE_FLOAT, TYPE_STRING,TYPE_INTEGER, TYPE_DATETIME
   } tdFuncType;
 
typedef struct {
   char           szNm[256];          // Identifier name, if not constant or computed
  
tdFuncType ft;
   union {
       double         dFloat;           // TYPE_FLOAT
       long           lInteger;           // TYPE_INTEGER
       time_t         tDateTime;      // TYPE_DATETIME
       char           szString[256];  // TYPE_STRING, max string size is 255
       } val;
   } tdFuncValue;
 
// All values
typedef struct {
   long            lCt;     // Number of actual values: 1 to 11
   tdFuncValue  fv[11];  // Values
   } tdFuncValues;
 
Any ideas ?
 
Thanks.
 
Pr. 


 

Answers (2)
0
Raja

Raja

NA 1.7k 45.3k 8y
This is Web.config Code
~~~~~~~~~~~~~~~~~~~~
 
 
 
<configuration>
  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
    </authentication>
    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
      </providers>
    </membership>
    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>
    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
      </providers>
    </roleManager>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <rewrite>
    <rules>
      <rule name="Fail Bad request">
        <match url=".*"/>
        <conditions>
          <add input="{HTTP_HOST}" pattern="localhost" negate="true"/>
        </conditions>
        <action types="AbortRequest"/>

      </rule>
      <rule name="Redirect From Blog">
        <match url="^blog/([_0-9a-z-]+)/([0-9]+)" />
        <action type="Redirect" url="article/{R:2}/{R:1}" redirectType="Found"/>

      </rule>
      <rule name="Rewrite to article.aspx">
        <match url="^article/([0-9]+)/([_0-9a-z-]+)" />
        <action type="Rewrite" url="article.aspx?id={R:1}&amp;title={R:2}"/>
        </rule>
      </rules>
  </rewrite>
</configuration>
0
Manas Mohapatra

Manas Mohapatra

NA 29.3k 3.3m 8y
Please put the urlrewrite tag in proper place(proper tag). Provide the code how you are writing in web.config file..